discovery: limit NumBlocks to best known height for outgoing QueryChannelRange

This is done to ensure we don't receive replies for channels in blocks
not currently known to us, which we wouldn't be able to process.
This commit is contained in:
Wilmer Paulino committed 2020-12-08 15:18:06 -08:00
1 parent 592a0c5699
commit c5fc7334a4
5 files changed
+54 -23

No files matched your search

+7 -1
View File
@@ -89,6 +89,9 @@ type SyncManagerCfg struct {
// This prevents ranges with old start times from causing us to dump the
// graph on connect.
IgnoreHistoricalFilters bool
// BestHeight returns the latest height known of the chain.
BestHeight func() uint32
}
// SyncManager is a subsystem of the gossiper that manages the gossip syncers
@@ -419,7 +422,10 @@ func (m *SyncManager) createGossipSyncer(peer lnpeer.Peer) *GossipSyncer {
sendToPeerSync: func(msgs ...lnwire.Message) error {
return peer.SendMessageLazy(true, msgs...)
},
ignoreHistoricalFilters: m.cfg.IgnoreHistoricalFilters,
ignoreHistoricalFilters: m.cfg.IgnoreHistoricalFilters,
maxUndelayedQueryReplies: DefaultMaxUndelayedQueryReplies,
delayedQueryReplyInterval: DefaultDelayedQueryReplyInterval,
bestHeight: m.cfg.BestHeight,
})
// Gossip syncers are initialized by default in a PassiveSync type