Skip to content

Commit ff91b51

Browse files
authored
Merge pull request #1004 from hieblmi/withdraw-fixes
staticaddr: robustness fixes for withdrawals
2 parents 1f8f282 + d0670f1 commit ff91b51

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

staticaddr/withdraw/manager.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ var (
4646
ErrMissingPreviousWithdrawn = errors.New("can't bump fee for subset " +
4747
"of clustered deposits")
4848

49+
// ErrMissingFinalizedTx is returned if previously withdrawn deposits
50+
// don't have a finalized withdrawal tx attached.
51+
ErrMissingFinalizedTx = errors.New("deposit does not have a " +
52+
"finalized withdrawal tx, can't bump fee")
53+
4954
// MinConfs is the minimum number of confirmations we require for a
5055
// deposit to be considered withdrawn.
5156
MinConfs int32 = 3
@@ -330,6 +335,14 @@ func (m *Manager) WithdrawDeposits(ctx context.Context,
330335
return "", "", ErrWithdrawingMixedDeposits
331336
}
332337

338+
// Ensure that all previously withdrawn deposits reference their
339+
// finalized withdrawal tx.
340+
for _, d := range deposits {
341+
if d.FinalizedWithdrawalTx == nil {
342+
return "", "", ErrMissingFinalizedTx
343+
}
344+
}
345+
333346
// If republishing of an existing withdrawal is requested we
334347
// ensure that all deposits remain clustered in the context of
335348
// the same withdrawal tx. We do this by checking that they have

0 commit comments

Comments
 (0)