mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-28 14:40:51 +02:00
discovery: prevent endBlock overflow in replyChanRangeQuery
Modifies syncer.replyChanRangeQuery method to use the LastBlockHeight method on the query. LastBlockHeight safely calculates the ending block height and prevents an overflow of start_block + num_blocks. Prior to this change, query messages that had a start_block + num_blocks that overflows uint32_max would return zero results in the reply message. Tests are added to fix the bug and ensure proper start and end values are supplied to the channel graph filter.
This commit is contained in:
@@ -918,7 +918,7 @@ func (g *GossipSyncer) replyChanRangeQuery(query *lnwire.QueryChannelRange) erro
|
||||
// Next, we'll consult the time series to obtain the set of known
|
||||
// channel ID's that match their query.
|
||||
startBlock := query.FirstBlockHeight
|
||||
endBlock := startBlock + query.NumBlocks - 1
|
||||
endBlock := query.LastBlockHeight()
|
||||
channelRange, err := g.cfg.channelSeries.FilterChannelRange(
|
||||
query.ChainHash, startBlock, endBlock,
|
||||
)
|
||||
|
Reference in New Issue
Block a user