htlcswitch/mailbox: block until mailbox shutdown
Fixes a bug where Stop() wouldn't actually wait for the mailbox to exit.
This commit is contained in:
2 files changed
+63
-6
No files matched your search
@@ -148,6 +148,28 @@ func TestMailBoxCouriers(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestMailBoxResetAfterShutdown tests that ResetMessages and ResetPackets
|
||||
// return ErrMailBoxShuttingDown after the mailbox has been stopped.
|
||||
func TestMailBoxResetAfterShutdown(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
m := newMemoryMailBox()
|
||||
m.Start()
|
||||
|
||||
// Stop the mailbox, then try to reset the message and packet couriers.
|
||||
m.Stop()
|
||||
|
||||
err := m.ResetMessages()
|
||||
if err != ErrMailBoxShuttingDown {
|
||||
t.Fatalf("expected ErrMailBoxShuttingDown, got: %v", err)
|
||||
}
|
||||
|
||||
err = m.ResetPackets()
|
||||
if err != ErrMailBoxShuttingDown {
|
||||
t.Fatalf("expected ErrMailBoxShuttingDown, got: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// TestMailOrchestrator asserts that the orchestrator properly buffers packets
|
||||
// for channels that haven't been made live, such that they are delivered
|
||||
// immediately after BindLiveShortChanID. It also tests that packets are delivered
|
||||
|
||||
Reference in new issue
Block a user