mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-25 02:31:46 +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
|
bcR.evsw = evsw
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FastSync returns whether the blockchain reactor is currently fast syncing
|
||||||
|
func (bcR *BlockchainReactor) FastSync() bool {
|
||||||
|
return bcR.fastSync
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Messages
|
// Messages
|
||||||
|
|
||||||
|
@ -315,6 +315,7 @@ func (n *Node) ConfigureRPC() {
|
|||||||
rpccore.SetAddrBook(n.addrBook)
|
rpccore.SetAddrBook(n.addrBook)
|
||||||
rpccore.SetProxyAppQuery(n.proxyApp.Query())
|
rpccore.SetProxyAppQuery(n.proxyApp.Query())
|
||||||
rpccore.SetTxIndexer(n.txIndexer)
|
rpccore.SetTxIndexer(n.txIndexer)
|
||||||
|
rpccore.SetBlockchainReactor(n.bcReactor)
|
||||||
rpccore.SetLogger(n.Logger.With("module", "rpc"))
|
rpccore.SetLogger(n.Logger.With("module", "rpc"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ package core
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
crypto "github.com/tendermint/go-crypto"
|
crypto "github.com/tendermint/go-crypto"
|
||||||
|
"github.com/tendermint/tendermint/blockchain"
|
||||||
"github.com/tendermint/tendermint/consensus"
|
"github.com/tendermint/tendermint/consensus"
|
||||||
p2p "github.com/tendermint/tendermint/p2p"
|
p2p "github.com/tendermint/tendermint/p2p"
|
||||||
"github.com/tendermint/tendermint/proxy"
|
"github.com/tendermint/tendermint/proxy"
|
||||||
@ -45,6 +46,7 @@ var (
|
|||||||
genDoc *types.GenesisDoc // cache the genesis structure
|
genDoc *types.GenesisDoc // cache the genesis structure
|
||||||
addrBook *p2p.AddrBook
|
addrBook *p2p.AddrBook
|
||||||
txIndexer txindex.TxIndexer
|
txIndexer txindex.TxIndexer
|
||||||
|
bcReactor *blockchain.BlockchainReactor
|
||||||
|
|
||||||
logger log.Logger
|
logger log.Logger
|
||||||
)
|
)
|
||||||
@ -89,6 +91,10 @@ func SetTxIndexer(indexer txindex.TxIndexer) {
|
|||||||
txIndexer = indexer
|
txIndexer = indexer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func SetBlockchainReactor(bc *blockchain.BlockchainReactor) {
|
||||||
|
bcReactor = bc
|
||||||
|
}
|
||||||
|
|
||||||
func SetLogger(l log.Logger) {
|
func SetLogger(l log.Logger) {
|
||||||
logger = l
|
logger = l
|
||||||
}
|
}
|
||||||
|
@ -27,5 +27,6 @@ func Status() (*ctypes.ResultStatus, error) {
|
|||||||
LatestBlockHash: latestBlockHash,
|
LatestBlockHash: latestBlockHash,
|
||||||
LatestAppHash: latestAppHash,
|
LatestAppHash: latestAppHash,
|
||||||
LatestBlockHeight: latestHeight,
|
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"`
|
LatestAppHash data.Bytes `json:"latest_app_hash"`
|
||||||
LatestBlockHeight int `json:"latest_block_height"`
|
LatestBlockHeight int `json:"latest_block_height"`
|
||||||
LatestBlockTime int64 `json:"latest_block_time"` // nano
|
LatestBlockTime int64 `json:"latest_block_time"` // nano
|
||||||
|
Syncing bool `json:"syncing"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *ResultStatus) TxIndexEnabled() bool {
|
func (s *ResultStatus) TxIndexEnabled() bool {
|
||||||
|
Reference in New Issue
Block a user