Skip to content

Commit 2628103

Browse files
committed
rpc/api: fixed default gas-(price) issue.
1 parent e79cc42 commit 2628103

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

rpc/api/eth.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,14 @@ func (self *ethApi) SendTransaction(req *shared.Request) (interface{}, error) {
259259
nonce = args.Nonce.String()
260260
}
261261

262-
v, err := self.xeth.Transact(args.From, args.To, nonce, args.Value.String(), args.Gas.String(), args.GasPrice.String(), args.Data)
262+
var gas, price string
263+
if args.Gas != nil {
264+
gas = args.Gas.String()
265+
}
266+
if args.GasPrice != nil {
267+
price = args.GasPrice.String()
268+
}
269+
v, err := self.xeth.Transact(args.From, args.To, nonce, args.Value.String(), gas, price, args.Data)
263270
if err != nil {
264271
return nil, err
265272
}

rpc/api/eth_args.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -333,19 +333,15 @@ func (args *NewTxArgs) UnmarshalJSON(b []byte) (err error) {
333333
args.Value = num
334334

335335
num = nil
336-
if ext.Gas == nil {
337-
num = big.NewInt(0)
338-
} else {
336+
if ext.Gas != nil {
339337
if num, err = numString(ext.Gas); err != nil {
340338
return err
341339
}
342340
}
343341
args.Gas = num
344342

345343
num = nil
346-
if ext.GasPrice == nil {
347-
num = big.NewInt(0)
348-
} else {
344+
if ext.GasPrice != nil {
349345
if num, err = numString(ext.GasPrice); err != nil {
350346
return err
351347
}

0 commit comments

Comments
 (0)