mirror of
https://github.com/tendermint/tendermint.git
synced 2026-07-30 03:52:50 +00:00
rpc: add more nil checks in the status end point (#8287)
This commit is contained in:
@@ -77,14 +77,25 @@ func (env *Environment) Status(ctx context.Context) (*coretypes.ResultStatus, er
|
||||
EarliestAppHash: earliestAppHash,
|
||||
EarliestBlockHeight: earliestBlockHeight,
|
||||
EarliestBlockTime: time.Unix(0, earliestBlockTimeNano),
|
||||
MaxPeerBlockHeight: env.BlockSyncReactor.GetMaxPeerBlockHeight(),
|
||||
CatchingUp: env.ConsensusReactor.WaitSync(),
|
||||
TotalSyncedTime: env.BlockSyncReactor.GetTotalSyncedTime(),
|
||||
RemainingTime: env.BlockSyncReactor.GetRemainingSyncTime(),
|
||||
// this should start as true, if consensus
|
||||
// hasn't started yet, and then flip to false
|
||||
// (or true,) depending on what's actually
|
||||
// happening.
|
||||
CatchingUp: true,
|
||||
},
|
||||
ValidatorInfo: validatorInfo,
|
||||
}
|
||||
|
||||
if env.ConsensusReactor != nil {
|
||||
result.SyncInfo.CatchingUp = env.ConsensusReactor.WaitSync()
|
||||
}
|
||||
|
||||
if env.BlockSyncReactor != nil {
|
||||
result.SyncInfo.MaxPeerBlockHeight = env.BlockSyncReactor.GetMaxPeerBlockHeight()
|
||||
result.SyncInfo.TotalSyncedTime = env.BlockSyncReactor.GetTotalSyncedTime()
|
||||
result.SyncInfo.RemainingTime = env.BlockSyncReactor.GetRemainingSyncTime()
|
||||
}
|
||||
|
||||
if env.StateSyncMetricer != nil {
|
||||
result.SyncInfo.TotalSnapshots = env.StateSyncMetricer.TotalSnapshots()
|
||||
result.SyncInfo.ChunkProcessAvgTime = env.StateSyncMetricer.ChunkProcessAvgTime()
|
||||
@@ -103,6 +114,9 @@ func (env *Environment) validatorAtHeight(h int64) *types.Validator {
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
if env.ConsensusState == nil {
|
||||
return nil
|
||||
}
|
||||
if env.PubKey == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user