mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-28 06:32:18 +02:00
multi: start asking for update timestamps in QueryChannelRange
This commit also adds a new `protocol.no-timestamp-query-option` option to disable the new behaviour.
This commit is contained in:
@@ -271,6 +271,11 @@ type gossipSyncerCfg struct {
|
||||
// peer.
|
||||
noReplyQueries bool
|
||||
|
||||
// noTimestampQueryOption will prevent the GossipSyncer from querying
|
||||
// timestamps of announcement messages from the peer, and it will
|
||||
// prevent it from responding to timestamp queries.
|
||||
noTimestampQueryOption bool
|
||||
|
||||
// ignoreHistoricalFilters will prevent syncers from replying with
|
||||
// historical data when the remote peer sets a gossip_timestamp_range.
|
||||
// This prevents ranges with old start times from causing us to dump the
|
||||
@@ -922,7 +927,7 @@ func (g *GossipSyncer) genChanRangeQuery(
|
||||
case newestChan.BlockHeight <= chanRangeQueryBuffer:
|
||||
startHeight = 0
|
||||
default:
|
||||
startHeight = uint32(newestChan.BlockHeight - chanRangeQueryBuffer)
|
||||
startHeight = newestChan.BlockHeight - chanRangeQueryBuffer
|
||||
}
|
||||
|
||||
// Determine the number of blocks to request based on our best height.
|
||||
@@ -945,6 +950,11 @@ func (g *GossipSyncer) genChanRangeQuery(
|
||||
FirstBlockHeight: startHeight,
|
||||
NumBlocks: numBlocks,
|
||||
}
|
||||
|
||||
if !g.cfg.noTimestampQueryOption {
|
||||
query.QueryOptions = lnwire.NewTimestampQueryOption()
|
||||
}
|
||||
|
||||
g.curQueryRangeMsg = query
|
||||
|
||||
return query, nil
|
||||
|
Reference in New Issue
Block a user