Skip to content

Commit

Permalink
Return hex encoded number in eth_getBlockTransactionCountByNumber end…
Browse files Browse the repository at this point in the history
…point (#1559)
  • Loading branch information
begmaroman committed May 26, 2023
1 parent c2f643f commit 709a1d2
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 8 deletions.
2 changes: 1 addition & 1 deletion jsonrpc/eth_blockchain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func TestEth_Block_GetBlockTransactionCountByNumber(t *testing.T) {

assert.NoError(t, err)
assert.NotNil(t, res, "expected to return block, but got nil")
assert.Equal(t, res, 10)
assert.Equal(t, "0xa", res)
}

func TestEth_GetTransactionByHash(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion jsonrpc/eth_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func (e *Eth) GetBlockTransactionCountByNumber(number BlockNumber) (interface{},
return nil, nil
}

return len(block.Transactions), nil
return *types.EncodeUint64(uint64(len(block.Transactions))), nil
}

// BlockNumber returns current block number
Expand Down
6 changes: 0 additions & 6 deletions types/encoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,6 @@ func ParseUint256orHex(val *string) (*big.Int, error) {
return b, nil
}

func ParseInt64orHex(val *string) (int64, error) {
i, err := ParseUint64orHex(val)

return int64(i), err
}

func ParseBytes(val *string) ([]byte, error) {
if val == nil {
return []byte{}, nil
Expand Down

0 comments on commit 709a1d2

Please sign in to comment.