discovery/syncer: add flag to prevent historical gossip filter dump

This commit is contained in:
Conner Fromknecht
2019-07-30 17:25:14 -07:00
parent add905d17f
commit 35a2de23a3
2 changed files with 74 additions and 0 deletions

View File

@@ -235,6 +235,12 @@ type gossipSyncerCfg struct {
// replyHandler, meaning we will not reply to queries from our remote
// peer.
noReplyQueries 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
// graph on connect.
ignoreHistoricalFilters bool
}
// GossipSyncer is a struct that handles synchronizing the channel graph state
@@ -951,6 +957,12 @@ func (g *GossipSyncer) ApplyGossipFilter(filter *lnwire.GossipTimestampRange) er
g.Unlock()
// If requested, don't reply with historical gossip data when the remote
// peer sets their gossip timestamp range.
if g.cfg.ignoreHistoricalFilters {
return nil
}
// Now that the remote peer has applied their filter, we'll query the
// database for all the messages that are beyond this filter.
newUpdatestoSend, err := g.cfg.channelSeries.UpdatesInHorizon(