mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-27 14:11:04 +02:00
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:
@@ -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