Skip to content

Commit 1882939

Browse files
committed
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.
1 parent 15d8f96 commit 1882939

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lnwallet/chancloser/rbf_coop_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -825,10 +825,13 @@ func newRbfCloserTestHarness(t *testing.T,
825825
).Return(nil)
826826

827827
chanCloser := protofsm.NewStateMachine(protoCfg)
828-
chanCloser.Start(ctx)
829828

829+
// We register our subscriber before starting the state machine, to make
830+
// sure we don't miss any events.
830831
harness.stateSub = chanCloser.RegisterStateEvents()
831832

833+
chanCloser.Start(ctx)
834+
832835
harness.chanCloser = &chanCloser
833836

834837
return harness

0 commit comments

Comments
 (0)