diff --git a/chainntnfs/bitcoindnotify/bitcoind.go b/chainntnfs/bitcoindnotify/bitcoind.go index 230443f61..3cf53978c 100644 --- a/chainntnfs/bitcoindnotify/bitcoind.go +++ b/chainntnfs/bitcoindnotify/bitcoind.go @@ -837,7 +837,11 @@ func (b *BitcoindNotifier) RegisterSpendNtfn(outpoint *wire.OutPoint, chainntnfs.Log.Debugf("Outpoint(%v) has spent at height %v", outpoint, spentHeight) - if spentHeight > ntfn.HistoricalDispatch.StartHeight { + // Since the tx has already been spent at spentHeight, the + // heightHint specified by the caller is no longer relevant. We + // now update the starting height to be the spent height to make + // sure we won't miss it in the rescan. + if spentHeight != ntfn.HistoricalDispatch.StartHeight { ntfn.HistoricalDispatch.StartHeight = spentHeight } } diff --git a/chainntnfs/btcdnotify/btcd.go b/chainntnfs/btcdnotify/btcd.go index abe9f7d22..91178044c 100644 --- a/chainntnfs/btcdnotify/btcd.go +++ b/chainntnfs/btcdnotify/btcd.go @@ -937,7 +937,11 @@ func (b *BtcdNotifier) RegisterSpendNtfn(outpoint *wire.OutPoint, chainntnfs.Log.Debugf("Outpoint(%v) has spent at height %v", outpoint, spentHeight) - if spentHeight > ntfn.HistoricalDispatch.StartHeight { + // Since the tx has already been spent at spentHeight, the + // heightHint specified by the caller is no longer relevant. We + // now update the starting height to be the spent height to make + // sure we won't miss it in the rescan. + if spentHeight != ntfn.HistoricalDispatch.StartHeight { startHash, err = b.chainConn.GetBlockHash( int64(spentHeight), )