mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-21 07:24:36 +00:00
rpc: add max peer block height into /status rpc call (#6610)
use `maxPeerBlockHeight` information to show the current network's best height. Closes #3983 Relate to #3365 ref: the`highestBlock` in the response of `eth.isSyncing` call https://web3js.readthedocs.io/en/v1.3.4/web3-eth.html#issyncing
This commit is contained in:
@@ -589,3 +589,7 @@ FOR_LOOP:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (r *Reactor) GetMaxPeerBlockHeight() int64 {
|
||||
return r.pool.MaxPeerHeight()
|
||||
}
|
||||
|
||||
@@ -590,3 +590,9 @@ func (r *BlockchainReactor) GetChannels() []*p2p.ChannelDescriptor {
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (r *BlockchainReactor) GetMaxPeerBlockHeight() int64 {
|
||||
r.mtx.RLock()
|
||||
defer r.mtx.RUnlock()
|
||||
return r.maxPeerHeight
|
||||
}
|
||||
|
||||
@@ -98,6 +98,14 @@ const (
|
||||
|
||||
type ReactorOption func(*Reactor)
|
||||
|
||||
// Temporary interface for switching to fast sync, we should get rid of v0.
|
||||
// See: https://github.com/tendermint/tendermint/issues/4595
|
||||
type FastSyncReactor interface {
|
||||
SwitchToFastSync(sm.State) error
|
||||
|
||||
GetMaxPeerBlockHeight() int64
|
||||
}
|
||||
|
||||
// Reactor defines a reactor for the consensus service.
|
||||
type Reactor struct {
|
||||
service.BaseService
|
||||
|
||||
Reference in New Issue
Block a user