From e0f0f5c6a9966149a88dd573bb3f7788d9fd0aa0 Mon Sep 17 00:00:00 2001 From: yyforyongyu Date: Thu, 18 Apr 2024 03:07:41 +0800 Subject: [PATCH] sweep: skip wallet inputs in `isThirdPartySpent` --- sweep/fee_bumper.go | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/sweep/fee_bumper.go b/sweep/fee_bumper.go index c052bb47b..61e63cc71 100644 --- a/sweep/fee_bumper.go +++ b/sweep/fee_bumper.go @@ -1039,13 +1039,24 @@ func (t *TxPublisher) isThirdPartySpent(txid chainhash.Hash, for _, inp := range inputs { op := inp.OutPoint() + // For wallet utxos, the height hint is not set - we don't need + // to monitor them for third party spend. + heightHint := inp.HeightHint() + if heightHint == 0 { + log.Debugf("Skipped third party check for wallet "+ + "input %v", op) + + continue + } + // If the input has already been spent after the height hint, a // spend event is sent back immediately. spendEvent, err := t.cfg.Notifier.RegisterSpendNtfn( - &op, inp.SignDesc().Output.PkScript, inp.HeightHint(), + &op, inp.SignDesc().Output.PkScript, heightHint, ) if err != nil { - log.Criticalf("Failed to register spend ntfn: %v", err) + log.Criticalf("Failed to register spend ntfn for "+ + "input=%v: %v", op, err) return false }