From c978c8f4ee184b3f2c5211814da4dfed55071fa1 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Mon, 4 Jan 2021 16:36:34 -0500 Subject: [PATCH] blockchain v0: refactor BroadcastStatusRequest --- blockchain/v0/reactor.go | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/blockchain/v0/reactor.go b/blockchain/v0/reactor.go index 591dd3a37..23055904a 100644 --- a/blockchain/v0/reactor.go +++ b/blockchain/v0/reactor.go @@ -349,6 +349,14 @@ func (r *Reactor) processPeerUpdates() { } } +// BroadcastStatusRequest broadcasts a StatusRequest envelope. +func (r *Reactor) BroadcastStatusRequest() { + r.blockchainCh.Out() <- p2p.Envelope{ + Broadcast: true, + Message: &bcproto.StatusRequest{}, + } +} + // ============================================================================ // ============================================================================ // ============================================================================ @@ -552,15 +560,3 @@ FOR_LOOP: } } } - -// BroadcastStatusRequest broadcasts `BlockStore` base and height. -func (bcR *BlockchainReactor) BroadcastStatusRequest() { - bm, err := bc.EncodeMsg(&bcproto.StatusRequest{}) - if err != nil { - bcR.Logger.Error("could not convert StatusRequest to proto", "err", err) - return - } - - // We don't care about whenever broadcast is successful or not. - _ = bcR.Switch.Broadcast(BlockchainChannel, bm) -}