mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-11-10 14:17:56 +01:00
sweep: skip wallet inputs in isThirdPartySpent
This commit is contained in:
@@ -1039,13 +1039,24 @@ func (t *TxPublisher) isThirdPartySpent(txid chainhash.Hash,
|
|||||||
for _, inp := range inputs {
|
for _, inp := range inputs {
|
||||||
op := inp.OutPoint()
|
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
|
// If the input has already been spent after the height hint, a
|
||||||
// spend event is sent back immediately.
|
// spend event is sent back immediately.
|
||||||
spendEvent, err := t.cfg.Notifier.RegisterSpendNtfn(
|
spendEvent, err := t.cfg.Notifier.RegisterSpendNtfn(
|
||||||
&op, inp.SignDesc().Output.PkScript, inp.HeightHint(),
|
&op, inp.SignDesc().Output.PkScript, heightHint,
|
||||||
)
|
)
|
||||||
if err != nil {
|
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
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user