Skip to content

Commit 5a43173

Browse files
committed
Merge pull request #373 from tgerring/issue370
Convert gas values to integers
2 parents 91a8c08 + 1e919a5 commit 5a43173

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

rpc/packages.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ import (
2525
"github.com/ethereum/go-ethereum/xeth"
2626
)
2727

28-
const (
29-
defaultGasPrice = "10000000000000"
30-
defaultGas = "10000"
28+
var (
29+
defaultGasPrice = big.NewInt(10000000000000)
30+
defaultGas = big.NewInt(10000)
3131
)
3232

3333
type EthereumApi struct {
@@ -185,11 +185,11 @@ func (p *EthereumApi) GetBlock(args *GetBlockArgs, reply *interface{}) error {
185185

186186
func (p *EthereumApi) Transact(args *NewTxArgs, reply *interface{}) error {
187187
if len(args.Gas) == 0 {
188-
args.Gas = defaultGas
188+
args.Gas = defaultGas.String()
189189
}
190190

191191
if len(args.GasPrice) == 0 {
192-
args.GasPrice = defaultGasPrice
192+
args.GasPrice = defaultGasPrice.String()
193193
}
194194

195195
// TODO if no_private_key then
@@ -516,7 +516,7 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
516516
}
517517
return p.AllLogs(args, reply)
518518
case "eth_gasPrice":
519-
*reply = defaultGasPrice
519+
*reply = toHex(defaultGasPrice.Bytes())
520520
return nil
521521
case "eth_register":
522522
args, err := req.ToRegisterArgs()

0 commit comments

Comments
 (0)