mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-01-18 21:35:24 +01:00
0ff0ac84f6
In this commit, we fix an existing race in the new `protofsm` state machine executor tests. The race would appear as such: ``` --- FAIL: TestStateMachineMsgMapper (0.00s) state_machine_test.go:165: Error Trace:/home/runner/work/lnd/lnd/protofsm/state_machine_test.go:165 /home/runner/work/lnd/lnd/protofsm/state_machine_test.go:451 Error: Object expected to be of type *protofsm.dummyStateStart, but was *protofsm.dummyStateFin Test: TestStateMachineMsgMapper FAIL FAILgithub.com/lightningnetwork/lnd/protofsm0.116s FAIL ``` This race condition was triggered as before we would start the state machine _then_ register for notifications. In `Start` we emit the starting event, then enter the main loop. If that event gets emitted before our subscription, then we'll miss the event, as the terminal event will be the only one received. We fix this by registering for the events before the daemon has started. |
||
---|---|---|
.. | ||
daemon_events.go | ||
log.go | ||
msg_mapper.go | ||
state_machine_test.go | ||
state_machine.go |