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:
5 files changed
+54
-23
No files matched your search
+17
-8
@@ -343,16 +343,18 @@ func New(cfg Config, selfKey *btcec.PublicKey) *AuthenticatedGossiper {
|
||||
channelMtx: multimutex.NewMutex(),
|
||||
recentRejects: make(map[uint64]struct{}),
|
||||
heightForLastChanUpdate: make(map[uint64][2]uint32),
|
||||
syncMgr: newSyncManager(&SyncManagerCfg{
|
||||
ChainHash: cfg.ChainHash,
|
||||
ChanSeries: cfg.ChanSeries,
|
||||
RotateTicker: cfg.RotateTicker,
|
||||
HistoricalSyncTicker: cfg.HistoricalSyncTicker,
|
||||
NumActiveSyncers: cfg.NumActiveSyncers,
|
||||
IgnoreHistoricalFilters: cfg.IgnoreHistoricalFilters,
|
||||
}),
|
||||
}
|
||||
|
||||
gossiper.syncMgr = newSyncManager(&SyncManagerCfg{
|
||||
ChainHash: cfg.ChainHash,
|
||||
ChanSeries: cfg.ChanSeries,
|
||||
RotateTicker: cfg.RotateTicker,
|
||||
HistoricalSyncTicker: cfg.HistoricalSyncTicker,
|
||||
NumActiveSyncers: cfg.NumActiveSyncers,
|
||||
IgnoreHistoricalFilters: cfg.IgnoreHistoricalFilters,
|
||||
BestHeight: gossiper.latestHeight,
|
||||
})
|
||||
|
||||
gossiper.reliableSender = newReliableSender(&reliableSenderCfg{
|
||||
NotifyWhenOnline: cfg.NotifyWhenOnline,
|
||||
NotifyWhenOffline: cfg.NotifyWhenOffline,
|
||||
@@ -2644,3 +2646,10 @@ func IsKeepAliveUpdate(update *lnwire.ChannelUpdate,
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// latestHeight returns the gossiper's latest height known of the chain.
|
||||
func (d *AuthenticatedGossiper) latestHeight() uint32 {
|
||||
d.Lock()
|
||||
defer d.Unlock()
|
||||
return d.bestHeight
|
||||
}
|
||||
Reference in new issue
Block a user