mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-24 02:01:43 +00:00
First crack it providing fast-sync endpoint
This commit is contained in:
@ -267,6 +267,11 @@ 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
|
||||
|
||||
|
@ -315,6 +315,7 @@ func (n *Node) ConfigureRPC() {
|
||||
rpccore.SetAddrBook(n.addrBook)
|
||||
rpccore.SetProxyAppQuery(n.proxyApp.Query())
|
||||
rpccore.SetTxIndexer(n.txIndexer)
|
||||
rpccore.SetBlockchainReactor(n.bcReactor)
|
||||
rpccore.SetLogger(n.Logger.With("module", "rpc"))
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@ 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"
|
||||
@ -45,6 +46,7 @@ var (
|
||||
genDoc *types.GenesisDoc // cache the genesis structure
|
||||
addrBook *p2p.AddrBook
|
||||
txIndexer txindex.TxIndexer
|
||||
bcReactor *blockchain.BlockchainReactor
|
||||
|
||||
logger log.Logger
|
||||
)
|
||||
@ -89,6 +91,10 @@ func SetTxIndexer(indexer txindex.TxIndexer) {
|
||||
txIndexer = indexer
|
||||
}
|
||||
|
||||
func SetBlockchainReactor(bc *blockchain.BlockchainReactor) {
|
||||
bcReactor = bc
|
||||
}
|
||||
|
||||
func SetLogger(l log.Logger) {
|
||||
logger = l
|
||||
}
|
||||
|
@ -27,5 +27,6 @@ func Status() (*ctypes.ResultStatus, error) {
|
||||
LatestBlockHash: latestBlockHash,
|
||||
LatestAppHash: latestAppHash,
|
||||
LatestBlockHeight: latestHeight,
|
||||
LatestBlockTime: latestBlockTime}, nil
|
||||
LatestBlockTime: latestBlockTime,
|
||||
Syncing: bcReactor.FastSync()}, nil
|
||||
}
|
||||
|
@ -38,6 +38,7 @@ type ResultStatus struct {
|
||||
LatestAppHash data.Bytes `json:"latest_app_hash"`
|
||||
LatestBlockHeight int `json:"latest_block_height"`
|
||||
LatestBlockTime int64 `json:"latest_block_time"` // nano
|
||||
Syncing bool `json:"syncing"`
|
||||
}
|
||||
|
||||
func (s *ResultStatus) TxIndexEnabled() bool {
|
||||
|
Reference in New Issue
Block a user