Skip to content

Commit 679ba13

Browse files
committed
staticaddr: don't lock active deposits across state transition
1 parent e704119 commit 679ba13

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
@@ -507,9 +507,9 @@ func (m *Manager) AllStringOutpointsActiveDeposits(outpoints []string,
507507
// TransitionDeposits allows a caller to transition a set of deposits to a new
508508
// state.
509509
// Caveat: The action triggered by the state transitions should not compute
510-
// heavy things or call external endpoints that can block for a long time.
511-
// Deposits will be released if a transition takes longer than
512-
// DefaultTransitionTimeout which is set to 5 seconds.
510+
// heavy things or call external endpoints that can block for a long time as
511+
// this function blocks until the expectedFinalState is reached. The default
512+
// timeout for the transition is set to DefaultTransitionTimeout.
513513
func (m *Manager) TransitionDeposits(ctx context.Context, deposits []*Deposit,
514514
event fsm.EventType, expectedFinalState fsm.StateType) error {
515515

@@ -519,9 +519,9 @@ func (m *Manager) TransitionDeposits(ctx context.Context, deposits []*Deposit,
519519
}
520520

521521
m.mu.Lock()
522-
defer m.mu.Unlock()
523-
524522
stateMachines, _ := m.toActiveDeposits(&outpoints)
523+
m.mu.Unlock()
524+
525525
if stateMachines == nil {
526526
return fmt.Errorf("deposits not found in active deposits")
527527
}

0 commit comments

Comments
 (0)