mirror of
https://github.com/fluencelabs/tendermint
synced 2025-07-31 12:11:58 +00:00
uint64 height (Refs #911)
This commit is contained in:
committed by
Ethan Buchman
parent
b2489b4318
commit
b3492356e6
@@ -61,16 +61,16 @@ import (
|
||||
// ```
|
||||
//
|
||||
// <aside class="notice">Returns at most 20 items.</aside>
|
||||
func BlockchainInfo(minHeight, maxHeight int) (*ctypes.ResultBlockchainInfo, error) {
|
||||
func BlockchainInfo(minHeight, maxHeight uint64) (*ctypes.ResultBlockchainInfo, error) {
|
||||
if maxHeight == 0 {
|
||||
maxHeight = blockStore.Height()
|
||||
} else {
|
||||
maxHeight = cmn.MinInt(blockStore.Height(), maxHeight)
|
||||
maxHeight = cmn.MinUint64(blockStore.Height(), maxHeight)
|
||||
}
|
||||
if minHeight == 0 {
|
||||
minHeight = cmn.MaxInt(1, maxHeight-20)
|
||||
minHeight = cmn.MaxUint64(1, maxHeight-20)
|
||||
} else {
|
||||
minHeight = cmn.MaxInt(minHeight, maxHeight-20)
|
||||
minHeight = cmn.MaxUint64(minHeight, maxHeight-20)
|
||||
}
|
||||
|
||||
logger.Debug("BlockchainInfoHandler", "maxHeight", maxHeight, "minHeight", minHeight)
|
||||
@@ -184,7 +184,7 @@ func BlockchainInfo(minHeight, maxHeight int) (*ctypes.ResultBlockchainInfo, err
|
||||
// "jsonrpc": "2.0"
|
||||
// }
|
||||
// ```
|
||||
func Block(heightPtr *int) (*ctypes.ResultBlock, error) {
|
||||
func Block(heightPtr *uint64) (*ctypes.ResultBlock, error) {
|
||||
if heightPtr == nil {
|
||||
height := blockStore.Height()
|
||||
blockMeta := blockStore.LoadBlockMeta(height)
|
||||
@@ -275,7 +275,7 @@ func Block(heightPtr *int) (*ctypes.ResultBlock, error) {
|
||||
// "jsonrpc": "2.0"
|
||||
// }
|
||||
// ```
|
||||
func Commit(heightPtr *int) (*ctypes.ResultCommit, error) {
|
||||
func Commit(heightPtr *uint64) (*ctypes.ResultCommit, error) {
|
||||
if heightPtr == nil {
|
||||
height := blockStore.Height()
|
||||
header := blockStore.LoadBlockMeta(height).Header
|
||||
|
@@ -42,7 +42,7 @@ import (
|
||||
// "jsonrpc": "2.0"
|
||||
// }
|
||||
// ```
|
||||
func Validators(heightPtr *int) (*ctypes.ResultValidators, error) {
|
||||
func Validators(heightPtr *uint64) (*ctypes.ResultValidators, error) {
|
||||
if heightPtr == nil {
|
||||
blockHeight, validators := consensusState.GetValidators()
|
||||
return &ctypes.ResultValidators{blockHeight, validators}, nil
|
||||
|
@@ -21,7 +21,7 @@ var subscribeTimeout = 5 * time.Second
|
||||
|
||||
type Consensus interface {
|
||||
GetState() *sm.State
|
||||
GetValidators() (int, []*types.Validator)
|
||||
GetValidators() (uint64, []*types.Validator)
|
||||
GetRoundState() *cstypes.RoundState
|
||||
}
|
||||
|
||||
|
@@ -84,7 +84,7 @@ func Tx(hash []byte, prove bool) (*ctypes.ResultTx, error) {
|
||||
}
|
||||
|
||||
height := r.Height
|
||||
index := r.Index
|
||||
index := int(r.Index) // XXX:overflow
|
||||
|
||||
var proof types.TxProof
|
||||
if prove {
|
||||
|
@@ -12,7 +12,7 @@ import (
|
||||
)
|
||||
|
||||
type ResultBlockchainInfo struct {
|
||||
LastHeight int `json:"last_height"`
|
||||
LastHeight uint64 `json:"last_height"`
|
||||
BlockMetas []*types.BlockMeta `json:"block_metas"`
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ type ResultStatus struct {
|
||||
PubKey crypto.PubKey `json:"pub_key"`
|
||||
LatestBlockHash data.Bytes `json:"latest_block_hash"`
|
||||
LatestAppHash data.Bytes `json:"latest_app_hash"`
|
||||
LatestBlockHeight int `json:"latest_block_height"`
|
||||
LatestBlockHeight uint64 `json:"latest_block_height"`
|
||||
LatestBlockTime int64 `json:"latest_block_time"` // nano
|
||||
Syncing bool `json:"syncing"`
|
||||
}
|
||||
@@ -86,7 +86,7 @@ type Peer struct {
|
||||
}
|
||||
|
||||
type ResultValidators struct {
|
||||
BlockHeight int `json:"block_height"`
|
||||
BlockHeight uint64 `json:"block_height"`
|
||||
Validators []*types.Validator `json:"validators"`
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user