Default gas

pull/633/head
obscuren 10 years ago
parent 55b1c1546b
commit 1e28b424e7
  1. 2
      rpc/api.go
  2. 2
      rpc/jeth.go
  3. 8
      xeth/xeth.go

@ -67,7 +67,7 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
case "eth_mining": case "eth_mining":
*reply = api.xeth().IsMining() *reply = api.xeth().IsMining()
case "eth_gasPrice": case "eth_gasPrice":
v := api.xeth().DefaultGas() v := xeth.DefaultGas()
*reply = common.ToHex(v.Bytes()) *reply = common.ToHex(v.Bytes())
case "eth_accounts": case "eth_accounts":
*reply = api.xeth().Accounts() *reply = api.xeth().Accounts()

@ -2,6 +2,7 @@ package rpc
import ( import (
"encoding/json" "encoding/json"
"fmt"
// "fmt" // "fmt"
"github.com/ethereum/go-ethereum/jsre" "github.com/ethereum/go-ethereum/jsre"
"github.com/robertkrimen/otto" "github.com/robertkrimen/otto"
@ -42,6 +43,7 @@ func (self *Jeth) Send(call otto.FunctionCall) (response otto.Value) {
var respif interface{} var respif interface{}
err = self.ethApi.GetRequestReply(&req, &respif) err = self.ethApi.GetRequestReply(&req, &respif)
if err != nil { if err != nil {
fmt.Printf("error: %s\n", err)
return self.err(-32603, err.Error(), req.Id) return self.err(-32603, err.Error(), req.Id)
} }
self.re.Set("ret_jsonrpc", jsonrpcver) self.re.Set("ret_jsonrpc", jsonrpcver)

@ -566,11 +566,11 @@ func (self *XEth) Call(fromStr, toStr, valueStr, gasStr, gasPriceStr, dataStr st
} }
if msg.gas.Cmp(big.NewInt(0)) == 0 { if msg.gas.Cmp(big.NewInt(0)) == 0 {
msg.gas = self.DefaultGas() msg.gas = DefaultGas()
} }
if msg.gasPrice.Cmp(big.NewInt(0)) == 0 { if msg.gasPrice.Cmp(big.NewInt(0)) == 0 {
msg.gasPrice = self.DefaultGasPrice() msg.gasPrice = DefaultGasPrice()
} }
block := self.CurrentBlock() block := self.CurrentBlock()
@ -616,11 +616,11 @@ func (self *XEth) Transact(fromStr, toStr, valueStr, gasStr, gasPriceStr, codeSt
// TODO: align default values to have the same type, e.g. not depend on // TODO: align default values to have the same type, e.g. not depend on
// common.Value conversions later on // common.Value conversions later on
if gas.Cmp(big.NewInt(0)) == 0 { if gas.Cmp(big.NewInt(0)) == 0 {
gas = self.DefaultGas() gas = DefaultGas()
} }
if price.Cmp(big.NewInt(0)) == 0 { if price.Cmp(big.NewInt(0)) == 0 {
price = self.DefaultGasPrice() price = DefaultGasPrice()
} }
data = common.FromHex(codeStr) data = common.FromHex(codeStr)

Loading…
Cancel
Save