mirror of
https://github.com/lightninglabs/pool.git
synced 2026-08-16 13:00:39 +02:00
account: remove fallthrough in transition StatePendingUpdate->StateOpen
This commit is contained in:
parent
dc8ad76c60
commit
687b1985ed
1 changed files with 7 additions and 10 deletions
|
|
@ -369,8 +369,6 @@ func (m *Manager) resumeAccount(ctx context.Context, account *Account,
|
|||
"%v", err)
|
||||
}
|
||||
|
||||
fallthrough
|
||||
|
||||
// In StateOpen, the funding transaction for the account has already
|
||||
// confirmed, so we only need to watch for its spend and expiration and
|
||||
// register for account updates.
|
||||
|
|
@ -515,13 +513,6 @@ func (m *Manager) handleAccountConf(traderKey *btcec.PublicKey,
|
|||
return err
|
||||
}
|
||||
|
||||
// To not rely on the order of confirmation and block notifications, if
|
||||
// the account confirms at the same height as it expires, we can exit
|
||||
// now and let the account be marked as expired by the watcher.
|
||||
if confDetails.BlockHeight == account.Expiry {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Ensure we don't transition an account that's been closed back to open
|
||||
// if the account was closed before it was open.
|
||||
if account.State != StatePendingOpen {
|
||||
|
|
@ -531,7 +522,13 @@ func (m *Manager) handleAccountConf(traderKey *btcec.PublicKey,
|
|||
log.Infof("Account %x is now confirmed at height %v!",
|
||||
traderKey.SerializeCompressed(), confDetails.BlockHeight)
|
||||
|
||||
return m.cfg.Store.UpdateAccount(account, StateModifier(StateOpen))
|
||||
// Mark the account as open and proceed with the rest of the flow.
|
||||
err = m.cfg.Store.UpdateAccount(account, StateModifier(StateOpen))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return m.handleStateOpen(context.Background(), account)
|
||||
}
|
||||
|
||||
// handleAccountSpend handles the different spend paths of an account. If an
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue