uint64 height (Refs #911)

This commit is contained in:
Anton Kaliaev
2017-11-30 13:08:38 -06:00
committed by Ethan Buchman
parent b2489b4318
commit b3492356e6
64 changed files with 296 additions and 270 deletions

View File

@ -53,7 +53,7 @@ func TestBlockEvents(t *testing.T) {
}
// listen for a new block; ensure height increases by 1
var firstBlockHeight int
var firstBlockHeight uint64
for j := 0; j < 3; j++ {
evtTyp := types.EventNewBlock
evt, err := client.WaitForOneEvent(c, evtTyp, waitForEventTimeout)
@ -67,7 +67,7 @@ func TestBlockEvents(t *testing.T) {
continue
}
require.Equal(block.Header.Height, firstBlockHeight+j)
require.Equal(block.Header.Height, firstBlockHeight+uint64(j))
}
}
}

View File

@ -32,7 +32,7 @@ func DefaultWaitStrategy(delta int) (abort error) {
//
// If waiter is nil, we use DefaultWaitStrategy, but you can also
// provide your own implementation
func WaitForHeight(c StatusClient, h int, waiter Waiter) error {
func WaitForHeight(c StatusClient, h uint64, waiter Waiter) error {
if waiter == nil {
waiter = DefaultWaitStrategy
}
@ -42,7 +42,7 @@ func WaitForHeight(c StatusClient, h int, waiter Waiter) error {
if err != nil {
return err
}
delta = h - s.LatestBlockHeight
delta = int(h - s.LatestBlockHeight)
// wait for the time, or abort early
if err := waiter(delta); err != nil {
return err

View File

@ -66,11 +66,11 @@ func TestWaitForHeight(t *testing.T) {
require.Nil(pre.Error)
prer, ok := pre.Response.(*ctypes.ResultStatus)
require.True(ok)
assert.Equal(10, prer.LatestBlockHeight)
assert.Equal(uint64(10), prer.LatestBlockHeight)
post := r.Calls[4]
require.Nil(post.Error)
postr, ok := post.Response.(*ctypes.ResultStatus)
require.True(ok)
assert.Equal(15, postr.LatestBlockHeight)
assert.Equal(uint64(15), postr.LatestBlockHeight)
}

View File

@ -123,7 +123,7 @@ func (c *HTTP) DumpConsensusState() (*ctypes.ResultDumpConsensusState, error) {
return result, nil
}
func (c *HTTP) BlockchainInfo(minHeight, maxHeight int) (*ctypes.ResultBlockchainInfo, error) {
func (c *HTTP) BlockchainInfo(minHeight, maxHeight uint64) (*ctypes.ResultBlockchainInfo, error) {
result := new(ctypes.ResultBlockchainInfo)
_, err := c.rpc.Call("blockchain",
map[string]interface{}{"minHeight": minHeight, "maxHeight": maxHeight},
@ -143,7 +143,7 @@ func (c *HTTP) Genesis() (*ctypes.ResultGenesis, error) {
return result, nil
}
func (c *HTTP) Block(height *int) (*ctypes.ResultBlock, error) {
func (c *HTTP) Block(height *uint64) (*ctypes.ResultBlock, error) {
result := new(ctypes.ResultBlock)
_, err := c.rpc.Call("block", map[string]interface{}{"height": height}, result)
if err != nil {
@ -152,7 +152,7 @@ func (c *HTTP) Block(height *int) (*ctypes.ResultBlock, error) {
return result, nil
}
func (c *HTTP) Commit(height *int) (*ctypes.ResultCommit, error) {
func (c *HTTP) Commit(height *uint64) (*ctypes.ResultCommit, error) {
result := new(ctypes.ResultCommit)
_, err := c.rpc.Call("commit", map[string]interface{}{"height": height}, result)
if err != nil {
@ -187,7 +187,7 @@ func (c *HTTP) TxSearch(query string, prove bool) ([]*ctypes.ResultTx, error) {
return *results, nil
}
func (c *HTTP) Validators(height *int) (*ctypes.ResultValidators, error) {
func (c *HTTP) Validators(height *uint64) (*ctypes.ResultValidators, error) {
result := new(ctypes.ResultValidators)
_, err := c.rpc.Call("validators", map[string]interface{}{"height": height}, result)
if err != nil {

View File

@ -46,9 +46,9 @@ type ABCIClient interface {
// SignClient groups together the interfaces need to get valid
// signatures and prove anything about the chain
type SignClient interface {
Block(height *int) (*ctypes.ResultBlock, error)
Commit(height *int) (*ctypes.ResultCommit, error)
Validators(height *int) (*ctypes.ResultValidators, error)
Block(height *uint64) (*ctypes.ResultBlock, error)
Commit(height *uint64) (*ctypes.ResultCommit, error)
Validators(height *uint64) (*ctypes.ResultValidators, error)
Tx(hash []byte, prove bool) (*ctypes.ResultTx, error)
TxSearch(query string, prove bool) ([]*ctypes.ResultTx, error)
}
@ -56,7 +56,7 @@ type SignClient interface {
// HistoryClient shows us data from genesis to now in large chunks.
type HistoryClient interface {
Genesis() (*ctypes.ResultGenesis, error)
BlockchainInfo(minHeight, maxHeight int) (*ctypes.ResultBlockchainInfo, error)
BlockchainInfo(minHeight, maxHeight uint64) (*ctypes.ResultBlockchainInfo, error)
}
type StatusClient interface {

View File

@ -100,7 +100,7 @@ func (Local) DialSeeds(seeds []string) (*ctypes.ResultDialSeeds, error) {
return core.UnsafeDialSeeds(seeds)
}
func (Local) BlockchainInfo(minHeight, maxHeight int) (*ctypes.ResultBlockchainInfo, error) {
func (Local) BlockchainInfo(minHeight, maxHeight uint64) (*ctypes.ResultBlockchainInfo, error) {
return core.BlockchainInfo(minHeight, maxHeight)
}
@ -108,15 +108,15 @@ func (Local) Genesis() (*ctypes.ResultGenesis, error) {
return core.Genesis()
}
func (Local) Block(height *int) (*ctypes.ResultBlock, error) {
func (Local) Block(height *uint64) (*ctypes.ResultBlock, error) {
return core.Block(height)
}
func (Local) Commit(height *int) (*ctypes.ResultCommit, error) {
func (Local) Commit(height *uint64) (*ctypes.ResultCommit, error) {
return core.Commit(height)
}
func (Local) Validators(height *int) (*ctypes.ResultValidators, error) {
func (Local) Validators(height *uint64) (*ctypes.ResultValidators, error) {
return core.Validators(height)
}

View File

@ -111,7 +111,7 @@ func (c Client) DialSeeds(seeds []string) (*ctypes.ResultDialSeeds, error) {
return core.UnsafeDialSeeds(seeds)
}
func (c Client) BlockchainInfo(minHeight, maxHeight int) (*ctypes.ResultBlockchainInfo, error) {
func (c Client) BlockchainInfo(minHeight, maxHeight uint64) (*ctypes.ResultBlockchainInfo, error) {
return core.BlockchainInfo(minHeight, maxHeight)
}
@ -119,14 +119,14 @@ func (c Client) Genesis() (*ctypes.ResultGenesis, error) {
return core.Genesis()
}
func (c Client) Block(height *int) (*ctypes.ResultBlock, error) {
func (c Client) Block(height *uint64) (*ctypes.ResultBlock, error) {
return core.Block(height)
}
func (c Client) Commit(height *int) (*ctypes.ResultCommit, error) {
func (c Client) Commit(height *uint64) (*ctypes.ResultCommit, error) {
return core.Commit(height)
}
func (c Client) Validators(height *int) (*ctypes.ResultValidators, error) {
func (c Client) Validators(height *uint64) (*ctypes.ResultValidators, error) {
return core.Validators(height)
}