mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-30 07:35:07 +02:00
discovery/syncer: store chunk size within gossiperSyncerCfg
In this commit, we allow the gossiper syncer to store the chunk size for its respective encoding type. We do this to prevent a race condition that would arise within the unit tests by modifying the values of the encodingTypeToChunkSize map to allow for easier testing.
This commit is contained in:
@@ -921,11 +921,13 @@ func (d *AuthenticatedGossiper) findGossipSyncer(pub *btcec.PublicKey) (*gossipS
|
||||
|
||||
// At this point, a syncer doesn't yet exist, so we'll create a new one
|
||||
// for the peer and return it to the caller.
|
||||
encoding := lnwire.EncodingSortedPlain
|
||||
syncer = newGossiperSyncer(gossipSyncerCfg{
|
||||
chainHash: d.cfg.ChainHash,
|
||||
syncChanUpdates: true,
|
||||
channelSeries: d.cfg.ChanSeries,
|
||||
encodingType: lnwire.EncodingSortedPlain,
|
||||
encodingType: encoding,
|
||||
chunkSize: encodingTypeToChunkSize[encoding],
|
||||
sendToPeer: func(msgs ...lnwire.Message) error {
|
||||
return syncPeer.SendMessage(false, msgs...)
|
||||
},
|
||||
@@ -1236,14 +1238,15 @@ func (d *AuthenticatedGossiper) InitSyncState(syncPeer lnpeer.Peer, recvUpdates
|
||||
return
|
||||
}
|
||||
|
||||
log.Infof("Creating new gossipSyncer for peer=%x",
|
||||
nodeID[:])
|
||||
log.Infof("Creating new gossipSyncer for peer=%x", nodeID[:])
|
||||
|
||||
encoding := lnwire.EncodingSortedPlain
|
||||
syncer := newGossiperSyncer(gossipSyncerCfg{
|
||||
chainHash: d.cfg.ChainHash,
|
||||
syncChanUpdates: recvUpdates,
|
||||
channelSeries: d.cfg.ChanSeries,
|
||||
encodingType: lnwire.EncodingSortedPlain,
|
||||
encodingType: encoding,
|
||||
chunkSize: encodingTypeToChunkSize[encoding],
|
||||
sendToPeer: func(msgs ...lnwire.Message) error {
|
||||
return syncPeer.SendMessage(false, msgs...)
|
||||
},
|
||||
|
Reference in New Issue
Block a user