Merge pull request #954 from hieblmi/fix-deadlock

staticaddr: fix deposit recovery deadlock
This commit is contained in:
Slyghtning 2025-06-23 10:59:47 +02:00 committed by GitHub
commit f7769d2bf8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

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