diff options
author | Taylor Gerring <taylor.gerring@gmail.com> | 2015-05-30 03:27:15 +0800 |
---|---|---|
committer | Taylor Gerring <taylor.gerring@gmail.com> | 2015-06-09 20:13:25 +0800 |
commit | c8a9a4e76d00483280a51bb6c0f9517d6c531589 (patch) | |
tree | 7b5b8de46655614b157aab9a21fc76d0f51ba0ec /rpc/api.go | |
parent | 0f1cdfa53ad445df7bf3aed281fc36e53ecbbfd4 (diff) | |
download | dexon-c8a9a4e76d00483280a51bb6c0f9517d6c531589.tar dexon-c8a9a4e76d00483280a51bb6c0f9517d6c531589.tar.gz dexon-c8a9a4e76d00483280a51bb6c0f9517d6c531589.tar.bz2 dexon-c8a9a4e76d00483280a51bb6c0f9517d6c531589.tar.lz dexon-c8a9a4e76d00483280a51bb6c0f9517d6c531589.tar.xz dexon-c8a9a4e76d00483280a51bb6c0f9517d6c531589.tar.zst dexon-c8a9a4e76d00483280a51bb6c0f9517d6c531589.zip |
Differentiate between 0 and unspecified gas/gasprice
Diffstat (limited to 'rpc/api.go')
-rw-r--r-- | rpc/api.go | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/rpc/api.go b/rpc/api.go index 6b37acb03..33789a55f 100644 --- a/rpc/api.go +++ b/rpc/api.go @@ -182,7 +182,21 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err nonce = args.Nonce.String() } - v, err := api.xeth().Transact(args.From, args.To, nonce, args.Value.String(), args.Gas.String(), args.GasPrice.String(), args.Data) + var gas string + if args.Gas == nil { + gas = "" + } else { + gas = args.Gas.String() + } + + var gasprice string + if args.GasPrice == nil { + gas = "" + } else { + gas = args.GasPrice.String() + } + + v, err := api.xeth().Transact(args.From, args.To, nonce, args.Value.String(), gas, gasprice, args.Data) if err != nil { return err } @@ -603,5 +617,19 @@ func (api *EthereumApi) doCall(params json.RawMessage) (string, string, error) { return "", "", err } - return api.xethAtStateNum(args.BlockNumber).Call(args.From, args.To, args.Value.String(), args.Gas.String(), args.GasPrice.String(), args.Data) + var gas string + if args.Gas == nil { + gas = "" + } else { + gas = args.Gas.String() + } + + var gasprice string + if args.GasPrice == nil { + gas = "" + } else { + gas = args.GasPrice.String() + } + + return api.xethAtStateNum(args.BlockNumber).Call(args.From, args.To, args.Value.String(), gas, gasprice, args.Data) } |