mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-04-30 23:10:23 +02:00
chainntnfs/neutrinonotify: update EndHeight after filter update
After the error is received on the filter update errChan, update the EndHeight if we're performing a historical scan. If a block was mined after the call to RegisterConf/RegisterSpend but before the filter was updated, then the block would not have the filter applied. This means that a block containing the desired conf/spend parameters would be undetected. Fix this by ensuring the historical scan also includes this height, as it would previously not be included.
This commit is contained in:
parent
0d39c0799a
commit
de71195bcb
@ -777,6 +777,14 @@ func (n *NeutrinoNotifier) RegisterSpendNtfn(outpoint *wire.OutPoint,
|
||||
return ntfn.Event, nil
|
||||
}
|
||||
|
||||
// Grab the current best height as the height may have been updated
|
||||
// while we were draining the chainUpdates queue.
|
||||
n.bestBlockMtx.RLock()
|
||||
currentHeight := uint32(n.bestBlock.Height)
|
||||
n.bestBlockMtx.RUnlock()
|
||||
|
||||
ntfn.HistoricalDispatch.EndHeight = currentHeight
|
||||
|
||||
// With the filter updated, we'll dispatch our historical rescan to
|
||||
// ensure we detect the spend if it happened in the past.
|
||||
n.wg.Add(1)
|
||||
@ -929,6 +937,14 @@ func (n *NeutrinoNotifier) RegisterConfirmationsNtfn(txid *chainhash.Hash,
|
||||
return ntfn.Event, nil
|
||||
}
|
||||
|
||||
// Grab the current best height as the height may have been updated
|
||||
// while we were draining the chainUpdates queue.
|
||||
n.bestBlockMtx.RLock()
|
||||
currentHeight := uint32(n.bestBlock.Height)
|
||||
n.bestBlockMtx.RUnlock()
|
||||
|
||||
ntfn.HistoricalDispatch.EndHeight = currentHeight
|
||||
|
||||
// Finally, with the filter updated, we can dispatch the historical
|
||||
// rescan to ensure we can detect if the event happened in the past.
|
||||
select {
|
||||
|
Loading…
x
Reference in New Issue
Block a user