Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions staticaddr/withdraw/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down