staticaddr: fix deposit recovery deadlock

This commit is contained in:
Slyghtning 2025-06-13 13:00:54 +02:00
parent 3153489ea2
commit c579a3e933
No known key found for this signature in database
GPG key ID: F82D456EA023C9BF

View file

@ -191,10 +191,15 @@ func (m *Manager) recoverDeposits(ctx context.Context) error {
}
// Send the OnRecover event to the state machine.
err = fsm.SendEvent(ctx, OnRecover, nil)
if err != nil {
log.Errorf("Error sending OnStart event: %v", err)
}
// TODO(hieblmi): Add a unit test that would fail with the
// dead-lock before the fsm was passed in.
go func(fsm *FSM) {
err := fsm.SendEvent(ctx, OnRecover, nil)
if err != nil {
log.Errorf("Error sending OnStart event: %v",
err)
}
}(fsm)
m.mu.Lock()
m.activeDeposits[d.OutPoint] = fsm