Skip to content

Commit da1bccd

Browse files
committed
withdraw: handle confirmation registration failures
1 parent fd339eb commit da1bccd

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

staticaddr/withdraw/manager.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -687,13 +687,21 @@ func (m *Manager) handleWithdrawal(ctx context.Context,
687687
// If the transaction received one confirmation, we
688688
// ensure re-org safety by waiting for some more
689689
// confirmations.
690-
var confChan chan *chainntnfs.TxConfirmation
691-
confChan, errChan, err =
690+
var (
691+
confChan chan *chainntnfs.TxConfirmation
692+
confErrChan chan error
693+
)
694+
confChan, confErrChan, err =
692695
m.cfg.ChainNotifier.RegisterConfirmationsNtfn(
693696
ctx, spentTx.SpenderTxHash,
694697
withdrawalPkscript, MinConfs,
695698
int32(m.initiationHeight.Load()),
696699
)
700+
if err != nil {
701+
log.Errorf("Error registering confirmation "+
702+
"notification: %v", err)
703+
return
704+
}
697705
select {
698706
case tx := <-confChan:
699707
err = m.cfg.DepositManager.TransitionDeposits(
@@ -722,7 +730,7 @@ func (m *Manager) handleWithdrawal(ctx context.Context,
722730
"withdrawal: %v", err)
723731
}
724732

725-
case err := <-errChan:
733+
case err := <-confErrChan:
726734
log.Errorf("Error waiting for confirmation: %v",
727735
err)
728736

0 commit comments

Comments
 (0)