mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-26 21:51:27 +02:00
chainntnfs: patch debug logs and fix StartHeight
Make sure we patch the `StartHeight` for btcd notifier.
This commit is contained in:
committed by
Olaoluwa Osuntokun
parent
270981eef0
commit
a806323035
@@ -833,8 +833,12 @@ func (b *BitcoindNotifier) RegisterSpendNtfn(outpoint *wire.OutPoint,
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if uint32(blockHeight) > ntfn.HistoricalDispatch.StartHeight {
|
||||
ntfn.HistoricalDispatch.StartHeight = uint32(blockHeight)
|
||||
spentHeight := uint32(blockHeight)
|
||||
chainntnfs.Log.Debugf("Outpoint(%v) has spent at height %v",
|
||||
outpoint, spentHeight)
|
||||
|
||||
if spentHeight > ntfn.HistoricalDispatch.StartHeight {
|
||||
ntfn.HistoricalDispatch.StartHeight = spentHeight
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -933,15 +933,21 @@ func (b *BtcdNotifier) RegisterSpendNtfn(outpoint *wire.OutPoint,
|
||||
"block %v: %v", blockHash, err)
|
||||
}
|
||||
|
||||
if uint32(blockHeader.Height) > ntfn.HistoricalDispatch.StartHeight {
|
||||
spentHeight := uint32(blockHeader.Height)
|
||||
chainntnfs.Log.Debugf("Outpoint(%v) has spent at height %v",
|
||||
outpoint, spentHeight)
|
||||
|
||||
if spentHeight > ntfn.HistoricalDispatch.StartHeight {
|
||||
startHash, err = b.chainConn.GetBlockHash(
|
||||
int64(blockHeader.Height),
|
||||
int64(spentHeight),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("unable to get block "+
|
||||
"hash for height %d: %v",
|
||||
blockHeader.Height, err)
|
||||
}
|
||||
|
||||
ntfn.HistoricalDispatch.StartHeight = spentHeight
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user