Skip to content

Commit c579a3e

Browse files
committed
staticaddr: fix deposit recovery deadlock
1 parent 3153489 commit c579a3e

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

staticaddr/deposit/manager.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,15 @@ func (m *Manager) recoverDeposits(ctx context.Context) error {
191191
}
192192

193193
// Send the OnRecover event to the state machine.
194-
err = fsm.SendEvent(ctx, OnRecover, nil)
195-
if err != nil {
196-
log.Errorf("Error sending OnStart event: %v", err)
197-
}
194+
// TODO(hieblmi): Add a unit test that would fail with the
195+
// dead-lock before the fsm was passed in.
196+
go func(fsm *FSM) {
197+
err := fsm.SendEvent(ctx, OnRecover, nil)
198+
if err != nil {
199+
log.Errorf("Error sending OnStart event: %v",
200+
err)
201+
}
202+
}(fsm)
198203

199204
m.mu.Lock()
200205
m.activeDeposits[d.OutPoint] = fsm

0 commit comments

Comments
 (0)