lnd/protofsm
Olaoluwa Osuntokun 0ff0ac84f6
protofsm: fix race in state machine executor tests
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.
2024-11-26 18:58:53 -06:00
..
daemon_events.go protofsm: add SpendMapper to craft custom spend events 2024-11-18 20:49:00 -08:00
log.go protofsm: allow multiple internal events to be emitted 2024-11-18 20:49:00 -08:00
msg_mapper.go protofsm: add ability for state machine to consume wire msgs 2024-11-18 20:48:59 -08:00
state_machine_test.go protofsm: fix race in state machine executor tests 2024-11-26 18:58:53 -06:00
state_machine.go protofsm: use new fn.GoroutineManager to manage goroutines 2024-11-18 20:49:01 -08:00