diff --git a/accounts/abi/bind/backends/simulated.go b/accounts/abi/bind/backends/simulated.go index 0ad7c0a62d..c4a93828ac 100644 --- a/accounts/abi/bind/backends/simulated.go +++ b/accounts/abi/bind/backends/simulated.go @@ -20,6 +20,8 @@ import ( "context" "errors" "fmt" + "github.com/paxosglobal/go-ethereum" + "github.com/paxosglobal/go-ethereum/common/hexutil" "math/big" "sync" "time" @@ -186,9 +188,9 @@ func (b *SimulatedBackend) TransactionByHash(ctx context.Context, txHash common. } // TransactionByHash returns the transaction with the given hash. -func (b *SimulatedBackend) TransactionByHashWithBlockNum(ctx context.Context, txHash common.Hash) (tx *types.Transaction, isPending string, err error) { +func (b *SimulatedBackend) TransactionByHashWithBlockNum(ctx context.Context, txHash common.Hash) (tx *types.Transaction, blockHexString string, err error) { transaction, _, blockNumber, _ := rawdb.ReadTransaction(b.database, txHash) - return transaction, string(blockNumber), nil + return transaction, hexutil.EncodeUint64(blockNumber), nil } // BlockByNumber retrieves a block from the database by number, caching it diff --git a/ethclient/ethclient.go b/ethclient/ethclient.go index c57c6a5c8f..ae81c5fc10 100644 --- a/ethclient/ethclient.go +++ b/ethclient/ethclient.go @@ -22,6 +22,7 @@ import ( "encoding/json" "errors" "fmt" + "github.com/paxosglobal/go-ethereum" "math/big" "github.com/ethereum/go-ethereum" @@ -189,22 +190,22 @@ func (tx *rpcTransaction) UnmarshalJSON(msg []byte) error { } // TransactionByHash returns the transaction with the given hash. -func (ec *Client) TransactionByHashWithBlockNum(ctx context.Context, hash common.Hash) (tx *types.Transaction, BlockNumber string, err error) { +func (ec *Client) TransactionByHashWithBlockNum(ctx context.Context, hash common.Hash) (tx *types.Transaction, blockHexString string, err error) { var json *rpcTransaction err = ec.c.CallContext(ctx, &json, "eth_getTransactionByHash", hash) if err != nil { - return nil, "0", err + return nil, "0x0", err } else if json == nil { - return nil, "0", ethereum.NotFound + return nil, "0x0", ethereum.NotFound } else if _, r, _ := json.tx.RawSignatureValues(); r == nil { - return nil, "0", fmt.Errorf("server returned transaction without signature") + return nil, "0x0", fmt.Errorf("server returned transaction without signature") } if json.From != nil && json.BlockHash != nil { setSenderFromServer(json.tx, *json.From, *json.BlockHash) } if json.BlockNumber == nil { - return json.tx, "0", nil + return json.tx, "0x0", nil } return json.tx, *json.BlockNumber, nil diff --git a/interfaces.go b/interfaces.go index 920271a272..c0603bfec9 100644 --- a/interfaces.go +++ b/interfaces.go @@ -85,7 +85,7 @@ type TransactionReader interface { TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error) // Same as TransactionByHash but returns the BlockNum - TransactionByHashWithBlockNum(ctx context.Context, hash common.Hash) (tx *types.Transaction, BlockNumber string, err error) + TransactionByHashWithBlockNum(ctx context.Context, hash common.Hash) (tx *types.Transaction, blockHexString string, err error) } // ChainStateReader wraps access to the state trie of the canonical blockchain. Note that