aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/api.go
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2015-06-09 20:49:55 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2015-06-09 20:49:55 +0800
commitf371e6c81a219b09b8c1822db764ab942ab8ca98 (patch)
tree297b58ce1acadc044325693fc8ed32bd9f1f7d0f /rpc/api.go
parent3054fd481175286591e5d867ec119e9151d02cb8 (diff)
parent1a967986428315b5551500f7db9c55c637fe6105 (diff)
downloaddexon-f371e6c81a219b09b8c1822db764ab942ab8ca98.tar.gz
dexon-f371e6c81a219b09b8c1822db764ab942ab8ca98.tar.zst
dexon-f371e6c81a219b09b8c1822db764ab942ab8ca98.zip
Merge pull request #1156 from tgerring/issue1145
Differentiate between 0 and unspecified gas/gasprice
Diffstat (limited to 'rpc/api.go')
-rw-r--r--rpc/api.go32
1 files changed, 30 insertions, 2 deletions
diff --git a/rpc/api.go b/rpc/api.go
index 6b37acb03..e35395734 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 {
+ gasprice = ""
+ } else {
+ gasprice = 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 {
+ gasprice = ""
+ } else {
+ gasprice = args.GasPrice.String()
+ }
+
+ return api.xethAtStateNum(args.BlockNumber).Call(args.From, args.To, args.Value.String(), gas, gasprice, args.Data)
}