diff --git a/jsonrpc/eth_blockchain_test.go b/jsonrpc/eth_blockchain_test.go index a348fabfce..07ef7d3d27 100644 --- a/jsonrpc/eth_blockchain_test.go +++ b/jsonrpc/eth_blockchain_test.go @@ -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) { diff --git a/jsonrpc/eth_endpoint.go b/jsonrpc/eth_endpoint.go index 0f7d07bdde..07c621287e 100644 --- a/jsonrpc/eth_endpoint.go +++ b/jsonrpc/eth_endpoint.go @@ -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 diff --git a/types/encoding.go b/types/encoding.go index b3d6b33688..58dfe6618b 100644 --- a/types/encoding.go +++ b/types/encoding.go @@ -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