Skip to content

Commit 46a7d5b

Browse files
committed
staticaddr: don't lock active deposits across state transition
1 parent cbab113 commit 46a7d5b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

staticaddr/deposit/manager.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -502,9 +502,9 @@ func (m *Manager) AllStringOutpointsActiveDeposits(outpoints []string,
502502
// TransitionDeposits allows a caller to transition a set of deposits to a new
503503
// state.
504504
// Caveat: The action triggered by the state transitions should not compute
505-
// heavy things or call external endpoints that can block for a long time.
506-
// Deposits will be released if a transition takes longer than
507-
// DefaultTransitionTimeout which is set to 5 seconds.
505+
// heavy things or call external endpoints that can block for a long time as
506+
// this function blocks until the expectedFinalState is reached. The default
507+
// timeout for the transition is set to DefaultTransitionTimeout.
508508
func (m *Manager) TransitionDeposits(ctx context.Context, deposits []*Deposit,
509509
event fsm.EventType, expectedFinalState fsm.StateType) error {
510510

@@ -514,9 +514,9 @@ func (m *Manager) TransitionDeposits(ctx context.Context, deposits []*Deposit,
514514
}
515515

516516
m.mu.Lock()
517-
defer m.mu.Unlock()
518-
519517
stateMachines, _ := m.toActiveDeposits(&outpoints)
518+
m.mu.Unlock()
519+
520520
if stateMachines == nil {
521521
return fmt.Errorf("deposits not found in active deposits")
522522
}

0 commit comments

Comments
 (0)