account: only transition accounts to StateOpen from StatePendingOpen
Otherwise, we can risk transitioning an account from another state,
e.g., StateExpired back to StateOpen if the account confirms at the same
height it expires.
@@ -425,6 +425,12 @@ func (m *Manager) handleAccountConf(traderKey *btcec.PublicKey,
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 {
+ return nil
+ }
+
log.Infof("Account %x is now confirmed at height %v!",
traderKey.SerializeCompressed(), confDetails.BlockHeight)
