diff options
Diffstat (limited to 'rpc')
-rw-r--r-- | rpc/api.go | 2 | ||||
-rw-r--r-- | rpc/api/eth.go | 11 | ||||
-rw-r--r-- | rpc/api/eth_args.go | 8 |
3 files changed, 12 insertions, 9 deletions
diff --git a/rpc/api.go b/rpc/api.go index e825accfd..a344a8294 100644 --- a/rpc/api.go +++ b/rpc/api.go @@ -59,7 +59,7 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err case "eth_mining": *reply = api.xeth().IsMining() case "eth_gasPrice": - v := xeth.DefaultGasPrice() + v := api.xeth().DefaultGasPrice() *reply = newHexNum(v.Bytes()) case "eth_accounts": *reply = api.xeth().Accounts() diff --git a/rpc/api/eth.go b/rpc/api/eth.go index e1e7381f5..cb678922b 100644 --- a/rpc/api/eth.go +++ b/rpc/api/eth.go @@ -140,7 +140,7 @@ func (self *ethApi) IsMining(req *shared.Request) (interface{}, error) { } func (self *ethApi) GasPrice(req *shared.Request) (interface{}, error) { - return newHexNum(xeth.DefaultGasPrice().Bytes()), nil + return newHexNum(self.xeth.DefaultGasPrice().Bytes()), nil } func (self *ethApi) GetStorage(req *shared.Request) (interface{}, error) { @@ -274,7 +274,14 @@ func (self *ethApi) SendTransaction(req *shared.Request) (interface{}, error) { nonce = args.Nonce.String() } - v, err := self.xeth.Transact(args.From, args.To, nonce, args.Value.String(), args.Gas.String(), args.GasPrice.String(), args.Data) + var gas, price string + if args.Gas != nil { + gas = args.Gas.String() + } + if args.GasPrice != nil { + price = args.GasPrice.String() + } + v, err := self.xeth.Transact(args.From, args.To, nonce, args.Value.String(), gas, price, args.Data) if err != nil { return nil, err } diff --git a/rpc/api/eth_args.go b/rpc/api/eth_args.go index 70fb18289..54eb7201d 100644 --- a/rpc/api/eth_args.go +++ b/rpc/api/eth_args.go @@ -362,9 +362,7 @@ func (args *NewTxArgs) UnmarshalJSON(b []byte) (err error) { args.Value = num num = nil - if ext.Gas == nil { - num = big.NewInt(0) - } else { + if ext.Gas != nil { if num, err = numString(ext.Gas); err != nil { return err } @@ -372,9 +370,7 @@ func (args *NewTxArgs) UnmarshalJSON(b []byte) (err error) { args.Gas = num num = nil - if ext.GasPrice == nil { - num = big.NewInt(0) - } else { + if ext.GasPrice != nil { if num, err = numString(ext.GasPrice); err != nil { return err } |