mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-25 21:21:33 +02:00
chancloser: fix flake by registering subscriber first
Fixes another flake in the unit-race test: Sometimes we miss startup events if there's a high CPU load (in CI for example). To avoid that, we register our subscriber before starting the state machine.
This commit is contained in:
@@ -825,10 +825,13 @@ func newRbfCloserTestHarness(t *testing.T,
|
||||
).Return(nil)
|
||||
|
||||
chanCloser := protofsm.NewStateMachine(protoCfg)
|
||||
chanCloser.Start(ctx)
|
||||
|
||||
// We register our subscriber before starting the state machine, to make
|
||||
// sure we don't miss any events.
|
||||
harness.stateSub = chanCloser.RegisterStateEvents()
|
||||
|
||||
chanCloser.Start(ctx)
|
||||
|
||||
harness.chanCloser = &chanCloser
|
||||
|
||||
return harness
|
||||
|
Reference in New Issue
Block a user