diff --git a/rpc/client/evidence_test.go b/rpc/client/evidence_test.go index 4a831553c..3db1b7eeb 100644 --- a/rpc/client/evidence_test.go +++ b/rpc/client/evidence_test.go @@ -117,6 +117,7 @@ func TestBroadcastEvidence_DuplicateVoteEvidence(t *testing.T) { config = rpctest.GetConfig() chainID = config.ChainID() ) + pv, err := privval.LoadOrGenFilePV(config.PrivValidatorKeyFile(), config.PrivValidatorStateFile()) require.NoError(t, err) diff --git a/rpc/client/helpers.go b/rpc/client/helpers.go index c9cd69590..c5e1ba7b3 100644 --- a/rpc/client/helpers.go +++ b/rpc/client/helpers.go @@ -10,11 +10,11 @@ import ( ) // Waiter is informed of current height, decided whether to quit early -type Waiter func(delta uint64) (abort error) +type Waiter func(delta int64) (abort error) // DefaultWaitStrategy is the standard backoff algorithm, // but you can plug in another one -func DefaultWaitStrategy(delta uint64) (abort error) { +func DefaultWaitStrategy(delta int64) (abort error) { if delta > 10 { return fmt.Errorf("waiting for %d blocks... aborting", delta) } else if delta > 0 { @@ -36,13 +36,13 @@ func WaitForHeight(c StatusClient, h uint64, waiter Waiter) error { if waiter == nil { waiter = DefaultWaitStrategy } - delta := uint64(1) + delta := int64(1) for delta > 0 { s, err := c.Status(context.Background()) if err != nil { return err } - delta = h - s.SyncInfo.LatestBlockHeight + delta = int64(h) - int64(s.SyncInfo.LatestBlockHeight) // wait for the time, or abort early if err := waiter(delta); err != nil { return err diff --git a/rpc/client/helpers_test.go b/rpc/client/helpers_test.go index 77c6b5ed3..8c715da9d 100644 --- a/rpc/client/helpers_test.go +++ b/rpc/client/helpers_test.go @@ -51,7 +51,7 @@ func TestWaitForHeight(t *testing.T) { // since we can't update in a background goroutine (test --race) // we use the callback to update the status height - myWaiter := func(delta uint64) error { + myWaiter := func(delta int64) error { // update the height for the next call m.Call.Response = &ctypes.ResultStatus{SyncInfo: ctypes.SyncInfo{LatestBlockHeight: 15}} return client.DefaultWaitStrategy(delta) @@ -67,11 +67,11 @@ func TestWaitForHeight(t *testing.T) { require.Nil(pre.Error) prer, ok := pre.Response.(*ctypes.ResultStatus) require.True(ok) - assert.Equal(int64(10), prer.SyncInfo.LatestBlockHeight) + assert.Equal(uint64(10), prer.SyncInfo.LatestBlockHeight) post := r.Calls[4] require.Nil(post.Error) postr, ok := post.Response.(*ctypes.ResultStatus) require.True(ok) - assert.Equal(int64(15), postr.SyncInfo.LatestBlockHeight) + assert.Equal(uint64(15), postr.SyncInfo.LatestBlockHeight) } diff --git a/rpc/client/rpc_test.go b/rpc/client/rpc_test.go index 84a4215c7..01f3695c5 100644 --- a/rpc/client/rpc_test.go +++ b/rpc/client/rpc_test.go @@ -526,6 +526,7 @@ func TestTxSearch(t *testing.T) { txCount := len(result.Txs) // pick out the last tx to have something to search for in tests + fmt.Println(len(result.Txs)) find := result.Txs[len(result.Txs)-1] anotherTxHash := types.Tx("a different tx").Hash() diff --git a/state/txindex/kv/kv.go b/state/txindex/kv/kv.go index b999a7ad3..b0462d3db 100644 --- a/state/txindex/kv/kv.go +++ b/state/txindex/kv/kv.go @@ -649,7 +649,7 @@ func secondaryKey(compositeKey, value string, height uint64, index uint32) []byt nil, compositeKey, value, - height, + int64(height), int64(index), ) if err != nil {