diff options
author | Felix Lange <fjl@twurst.com> | 2016-12-20 21:31:10 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2016-12-20 21:46:22 +0800 |
commit | 12c964b2b7c70949ae5a8c54cf73be7bbd8c97b4 (patch) | |
tree | 73d6780057bb56dc8061d020510140203c93dc7a | |
parent | cf71f5cd604f4d5c94d9e9b12b121a614d662dc7 (diff) | |
download | dexon-12c964b2b7c70949ae5a8c54cf73be7bbd8c97b4.tar dexon-12c964b2b7c70949ae5a8c54cf73be7bbd8c97b4.tar.gz dexon-12c964b2b7c70949ae5a8c54cf73be7bbd8c97b4.tar.bz2 dexon-12c964b2b7c70949ae5a8c54cf73be7bbd8c97b4.tar.lz dexon-12c964b2b7c70949ae5a8c54cf73be7bbd8c97b4.tar.xz dexon-12c964b2b7c70949ae5a8c54cf73be7bbd8c97b4.tar.zst dexon-12c964b2b7c70949ae5a8c54cf73be7bbd8c97b4.zip |
internal/ethapi: fix hex handling for eth_call input and eth_sendRawTransaction
-rw-r--r-- | eth/bind.go | 4 | ||||
-rw-r--r-- | internal/ethapi/api.go | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/eth/bind.go b/eth/bind.go index 6f7aee4f7..a9864b367 100644 --- a/eth/bind.go +++ b/eth/bind.go @@ -84,7 +84,7 @@ func toCallArgs(msg ethereum.CallMsg) ethapi.CallArgs { args := ethapi.CallArgs{ To: msg.To, From: msg.From, - Data: common.ToHex(msg.Data), + Data: msg.Data, } if msg.Gas != nil { args.Gas = hexutil.Big(*msg.Gas) @@ -135,6 +135,6 @@ func (b *ContractBackend) EstimateGas(ctx context.Context, msg ethereum.CallMsg) // into the pending pool for execution. func (b *ContractBackend) SendTransaction(ctx context.Context, tx *types.Transaction) error { raw, _ := rlp.EncodeToBytes(tx) - _, err := b.txapi.SendRawTransaction(ctx, common.ToHex(raw)) + _, err := b.txapi.SendRawTransaction(ctx, raw) return err } diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index cd6beedd9..b84bba516 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -485,7 +485,7 @@ type CallArgs struct { Gas hexutil.Big `json:"gas"` GasPrice hexutil.Big `json:"gasPrice"` Value hexutil.Big `json:"value"` - Data string `json:"data"` + Data hexutil.Bytes `json:"data"` } func (s *PublicBlockChainAPI) doCall(ctx context.Context, args CallArgs, blockNr rpc.BlockNumber) (string, *big.Int, error) { @@ -517,7 +517,7 @@ func (s *PublicBlockChainAPI) doCall(ctx context.Context, args CallArgs, blockNr if gasPrice.Cmp(common.Big0) == 0 { gasPrice = new(big.Int).Mul(big.NewInt(50), common.Shannon) } - msg := types.NewMessage(addr, args.To, 0, args.Value.ToInt(), gas, gasPrice, common.FromHex(args.Data), false) + msg := types.NewMessage(addr, args.To, 0, args.Value.ToInt(), gas, gasPrice, args.Data, false) // Execute the call and return vmenv, vmError, err := s.b.GetVMEnv(ctx, msg, state, header) @@ -1056,9 +1056,9 @@ func (s *PublicTransactionPoolAPI) SendTransaction(ctx context.Context, args Sen // SendRawTransaction will add the signed transaction to the transaction pool. // The sender is responsible for signing the transaction and using the correct nonce. -func (s *PublicTransactionPoolAPI) SendRawTransaction(ctx context.Context, encodedTx string) (string, error) { +func (s *PublicTransactionPoolAPI) SendRawTransaction(ctx context.Context, encodedTx hexutil.Bytes) (string, error) { tx := new(types.Transaction) - if err := rlp.DecodeBytes(common.FromHex(encodedTx), tx); err != nil { + if err := rlp.DecodeBytes(encodedTx, tx); err != nil { return "", err } |