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
-14
View File
@@ -32,8 +32,6 @@ func NewQuerier(keeper Keeper) sdk.Querier {
return queryStorage(ctx, path, keeper)
case types.QueryCode:
return queryCode(ctx, path, keeper)
case types.QueryNonce:
return queryNonce(ctx, path, keeper)
case types.QueryHashToHeight:
return queryHashToHeight(ctx, path, keeper)
case types.QueryTransactionLogs:
@@ -113,18 +111,6 @@ func queryCode(ctx sdk.Context, path []string, keeper Keeper) ([]byte, error) {
return bz, nil
}
func queryNonce(ctx sdk.Context, path []string, keeper Keeper) ([]byte, error) {
addr := ethcmn.HexToAddress(path[1])
nonce := keeper.GetNonce(ctx, addr)
nRes := types.QueryResNonce{Nonce: nonce}
bz, err := codec.MarshalJSONIndent(keeper.cdc, nRes)
if err != nil {
return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error())
}
return bz, nil
}
func queryHashToHeight(ctx sdk.Context, path []string, keeper Keeper) ([]byte, error) {
blockHash := ethcmn.FromHex(path[1])
blockNumber, err := keeper.GetBlockHashMapping(ctx, blockHash)
-1
View File
@@ -24,7 +24,6 @@ func (suite *KeeperTestSuite) TestQuerier() {
{"block number", []string{types.QueryBlockNumber, "0x0"}, func() {}, true},
{"storage", []string{types.QueryStorage, "0x0", "0x0"}, func() {}, true},
{"code", []string{types.QueryCode, "0x0"}, func() {}, true},
{"nonce", []string{types.QueryNonce, "0x0"}, func() {}, true},
// {"hash to height", []string{types.QueryHashToHeight, "0x0"}, func() {}, true},
{"tx logs", []string{types.QueryTransactionLogs, "0x0"}, func() {}, true},
// {"logs bloom", []string{types.QueryLogsBloom, "0x0"}, func() {}, true},