mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
staticaddr: add nil checks for withdrawals
This commit is contained in:
parent
1f8f282b00
commit
d0670f109b
1 changed files with 13 additions and 0 deletions
|
|
@ -46,6 +46,11 @@ var (
|
|||
ErrMissingPreviousWithdrawn = errors.New("can't bump fee for subset " +
|
||||
"of clustered deposits")
|
||||
|
||||
// ErrMissingFinalizedTx is returned if previously withdrawn deposits
|
||||
// don't have a finalized withdrawal tx attached.
|
||||
ErrMissingFinalizedTx = errors.New("deposit does not have a " +
|
||||
"finalized withdrawal tx, can't bump fee")
|
||||
|
||||
// MinConfs is the minimum number of confirmations we require for a
|
||||
// deposit to be considered withdrawn.
|
||||
MinConfs int32 = 3
|
||||
|
|
@ -330,6 +335,14 @@ func (m *Manager) WithdrawDeposits(ctx context.Context,
|
|||
return "", "", ErrWithdrawingMixedDeposits
|
||||
}
|
||||
|
||||
// Ensure that all previously withdrawn deposits reference their
|
||||
// finalized withdrawal tx.
|
||||
for _, d := range deposits {
|
||||
if d.FinalizedWithdrawalTx == nil {
|
||||
return "", "", ErrMissingFinalizedTx
|
||||
}
|
||||
}
|
||||
|
||||
// If republishing of an existing withdrawal is requested we
|
||||
// ensure that all deposits remain clustered in the context of
|
||||
// the same withdrawal tx. We do this by checking that they have
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue