Differentiate between 0 and unspecified gas/gasprice

This commit is contained in:
Taylor Gerring
2015-05-29 14:27:15 -05:00
parent 0f1cdfa53a
commit c8a9a4e76d
4 changed files with 73 additions and 36 deletions

View File

@@ -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)
}