Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert gas values to integers #373

Merged
merged 3 commits into from
Feb 24, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions rpc/packages.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ import (
"github.com/ethereum/go-ethereum/xeth"
)

const (
defaultGasPrice = "10000000000000"
defaultGas = "10000"
var (
defaultGasPrice = big.NewInt(10000000000000)
defaultGas = big.NewInt(10000)
)

type EthereumApi struct {
Expand Down Expand Up @@ -192,11 +192,11 @@ func (p *EthereumApi) GetBlock(args *GetBlockArgs, reply *interface{}) error {

func (p *EthereumApi) Transact(args *NewTxArgs, reply *interface{}) error {
if len(args.Gas) == 0 {
args.Gas = defaultGas
args.Gas = defaultGas.String()
}

if len(args.GasPrice) == 0 {
args.GasPrice = defaultGasPrice
args.GasPrice = defaultGasPrice.String()
}

// TODO if no_private_key then
Expand Down Expand Up @@ -525,7 +525,7 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
}
return p.AllLogs(args, reply)
case "eth_gasPrice":
*reply = defaultGasPrice
*reply = toHex(defaultGasPrice.Bytes())
return nil
case "eth_register":
args, err := req.ToRegisterArgs()
Expand Down