From 6f8d385dfae522e1cb030319bbd800edeb9b29bd Mon Sep 17 00:00:00 2001 From: ramil Date: Mon, 17 Jul 2017 09:44:23 +0300 Subject: [PATCH] fast sync status --- blockchain/reactor.go | 5 ----- consensus/reactor.go | 5 +++++ node/node.go | 2 +- rpc/core/pipe.go | 15 +++++++-------- rpc/core/status.go | 2 +- 5 files changed, 14 insertions(+), 15 deletions(-) diff --git a/blockchain/reactor.go b/blockchain/reactor.go index eca0a625..813d8f6b 100644 --- a/blockchain/reactor.go +++ b/blockchain/reactor.go @@ -267,11 +267,6 @@ func (bcR *BlockchainReactor) SetEventSwitch(evsw types.EventSwitch) { bcR.evsw = evsw } -// FastSync returns whether the blockchain reactor is currently fast syncing -func (bcR *BlockchainReactor) FastSync() bool { - return bcR.fastSync -} - //----------------------------------------------------------------------------- // Messages diff --git a/consensus/reactor.go b/consensus/reactor.go index f8a6dfae..801e010c 100644 --- a/consensus/reactor.go +++ b/consensus/reactor.go @@ -290,6 +290,11 @@ func (conR *ConsensusReactor) SetEventSwitch(evsw types.EventSwitch) { conR.conS.SetEventSwitch(evsw) } +// FastSync returns whether the consensus reactor is currently fast syncing +func (conR *ConsensusReactor) FastSync() bool { + return conR.fastSync +} + //-------------------------------------- // Listens for new steps and votes, diff --git a/node/node.go b/node/node.go index f11c0139..bd87798c 100644 --- a/node/node.go +++ b/node/node.go @@ -315,7 +315,7 @@ func (n *Node) ConfigureRPC() { rpccore.SetAddrBook(n.addrBook) rpccore.SetProxyAppQuery(n.proxyApp.Query()) rpccore.SetTxIndexer(n.txIndexer) - rpccore.SetBlockchainReactor(n.bcReactor) + rpccore.SetConsensusReactor(n.consensusReactor) rpccore.SetLogger(n.Logger.With("module", "rpc")) } diff --git a/rpc/core/pipe.go b/rpc/core/pipe.go index e581de8b..6c193059 100644 --- a/rpc/core/pipe.go +++ b/rpc/core/pipe.go @@ -2,7 +2,6 @@ package core import ( crypto "github.com/tendermint/go-crypto" - "github.com/tendermint/tendermint/blockchain" "github.com/tendermint/tendermint/consensus" p2p "github.com/tendermint/tendermint/p2p" "github.com/tendermint/tendermint/proxy" @@ -42,11 +41,11 @@ var ( p2pSwitch P2P // objects - pubKey crypto.PubKey - genDoc *types.GenesisDoc // cache the genesis structure - addrBook *p2p.AddrBook - txIndexer txindex.TxIndexer - bcReactor *blockchain.BlockchainReactor + pubKey crypto.PubKey + genDoc *types.GenesisDoc // cache the genesis structure + addrBook *p2p.AddrBook + txIndexer txindex.TxIndexer + consensusReactor *consensus.ConsensusReactor logger log.Logger ) @@ -91,8 +90,8 @@ func SetTxIndexer(indexer txindex.TxIndexer) { txIndexer = indexer } -func SetBlockchainReactor(bc *blockchain.BlockchainReactor) { - bcReactor = bc +func SetConsensusReactor(conR *consensus.ConsensusReactor) { + consensusReactor = conR } func SetLogger(l log.Logger) { diff --git a/rpc/core/status.go b/rpc/core/status.go index ca83031c..ba19c0e9 100644 --- a/rpc/core/status.go +++ b/rpc/core/status.go @@ -28,5 +28,5 @@ func Status() (*ctypes.ResultStatus, error) { LatestAppHash: latestAppHash, LatestBlockHeight: latestHeight, LatestBlockTime: latestBlockTime, - Syncing: bcReactor.FastSync()}, nil + Syncing: consensusReactor.FastSync()}, nil }