From aa3f777d966598b8c0e943d5e6bcea9deb58485f Mon Sep 17 00:00:00 2001 From: William Banfield Date: Mon, 15 Aug 2022 19:17:44 -0400 Subject: [PATCH] rename channel --- blocksync/reactor.go | 18 +++++++++--------- node/node.go | 2 +- spec/p2p/messages/block-sync.md | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/blocksync/reactor.go b/blocksync/reactor.go index 7a909c175..b922b030b 100644 --- a/blocksync/reactor.go +++ b/blocksync/reactor.go @@ -14,8 +14,8 @@ import ( ) const ( - // BlockchainChannel is a channel for blocks and status updates (`BlockStore` height) - BlockchainChannel = byte(0x40) + // BlocksyncChannel is a channel for blocks and status updates (`BlockStore` height) + BlocksyncChannel = byte(0x40) trySyncIntervalMS = 10 @@ -138,7 +138,7 @@ func (bcR *Reactor) OnStop() { func (bcR *Reactor) GetChannels() []*p2p.ChannelDescriptor { return []*p2p.ChannelDescriptor{ { - ID: BlockchainChannel, + ID: BlocksyncChannel, Priority: 5, SendQueueCapacity: 1000, RecvBufferCapacity: 50 * 4096, @@ -157,7 +157,7 @@ func (bcR *Reactor) AddPeer(peer p2p.Peer) { return } - peer.Send(BlockchainChannel, msgBytes) + peer.Send(BlocksyncChannel, msgBytes) // it's OK if send fails. will try later in poolRoutine // peer is added to the pool once we receive the first @@ -188,7 +188,7 @@ func (bcR *Reactor) respondToPeer(msg *bcproto.BlockRequest, return false } - return src.TrySend(BlockchainChannel, msgBytes) + return src.TrySend(BlocksyncChannel, msgBytes) } bcR.Logger.Info("Peer asking for a block we don't have", "src", src, "height", msg.Height) @@ -199,7 +199,7 @@ func (bcR *Reactor) respondToPeer(msg *bcproto.BlockRequest, return false } - return src.TrySend(BlockchainChannel, msgBytes) + return src.TrySend(BlocksyncChannel, msgBytes) } // Receive implements Reactor by handling 4 types of messages (look below). @@ -239,7 +239,7 @@ func (bcR *Reactor) Receive(chID byte, src p2p.Peer, msgBytes []byte) { bcR.Logger.Error("could not convert msg to protobut", "err", err) return } - src.TrySend(BlockchainChannel, msgBytes) + src.TrySend(BlocksyncChannel, msgBytes) case *bcproto.StatusResponse: // Got a peer status. Unverified. bcR.pool.SetPeerRange(src.ID(), msg.Base, msg.Height) @@ -291,7 +291,7 @@ func (bcR *Reactor) poolRoutine(stateSynced bool) { continue } - queued := peer.TrySend(BlockchainChannel, msgBytes) + queued := peer.TrySend(BlocksyncChannel, msgBytes) if !queued { bcR.Logger.Debug("Send queue is full, drop block request", "peer", peer.ID(), "height", request.Height) } @@ -430,7 +430,7 @@ func (bcR *Reactor) BroadcastStatusRequest() error { return fmt.Errorf("could not convert msg to proto: %w", err) } - bcR.Switch.Broadcast(BlockchainChannel, bm) + bcR.Switch.Broadcast(BlocksyncChannel, bm) return nil } diff --git a/node/node.go b/node/node.go index 85aa18d87..5b377751d 100644 --- a/node/node.go +++ b/node/node.go @@ -1335,7 +1335,7 @@ func makeNodeInfo( Network: genDoc.ChainID, Version: version.TMCoreSemVer, Channels: []byte{ - bc.BlockchainChannel, + bc.BlocksyncChannel, cs.StateChannel, cs.DataChannel, cs.VoteChannel, cs.VoteSetBitsChannel, mempl.MempoolChannel, evidence.EvidenceChannel, diff --git a/spec/p2p/messages/block-sync.md b/spec/p2p/messages/block-sync.md index 48aa6155f..122702f4f 100644 --- a/spec/p2p/messages/block-sync.md +++ b/spec/p2p/messages/block-sync.md @@ -10,7 +10,7 @@ Block sync has one channel. | Name | Number | |-------------------|--------| -| BlockchainChannel | 64 | +| BlocksyncChannel | 64 | ## Message Types