get account sequence in GetTransactionCount (#303)

* get account sequence if querying latest in GetTransactionCount

* use ctx WithHeight in GetTransactionCount; remove nonce query from querier
This commit is contained in:
noot
2020-05-17 11:15:32 -04:00
committed by GitHub
parent 1f63ddfe96
commit 846f48a572
4 changed files with 27 additions and 19 deletions
+18
View File
@@ -637,3 +637,21 @@ func TestBlockBloom_Hash(t *testing.T) {
lb := hexToBigInt(t, block["logsBloom"].(string))
require.NotEqual(t, big.NewInt(0), lb)
}
func getNonce(t *testing.T) hexutil.Uint64 {
from := getAddress(t)
param := []interface{}{hexutil.Bytes(from), "latest"}
rpcRes := call(t, "eth_getTransactionCount", param)
var nonce hexutil.Uint64
err := json.Unmarshal(rpcRes.Result, &nonce)
require.NoError(t, err)
return nonce
}
func TestEth_GetTransactionCount(t *testing.T) {
prev := getNonce(t)
sendTestTransaction(t)
post := getNonce(t)
require.Equal(t, prev, post-1)
}