diff options
-rw-r--r-- | rpc/api.go | 2 | ||||
-rw-r--r-- | rpc/jeth.go | 2 | ||||
-rw-r--r-- | xeth/xeth.go | 14 |
3 files changed, 10 insertions, 8 deletions
diff --git a/rpc/api.go b/rpc/api.go index 5e27890ce..afd242aa3 100644 --- a/rpc/api.go +++ b/rpc/api.go @@ -67,7 +67,7 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err case "eth_mining": *reply = api.xeth().IsMining() case "eth_gasPrice": - v := api.xeth().DefaultGas() + v := xeth.DefaultGas() *reply = common.ToHex(v.Bytes()) case "eth_accounts": *reply = api.xeth().Accounts() diff --git a/rpc/jeth.go b/rpc/jeth.go index 9d33f45e1..e83212bb5 100644 --- a/rpc/jeth.go +++ b/rpc/jeth.go @@ -2,6 +2,7 @@ package rpc import ( "encoding/json" + "fmt" // "fmt" "github.com/ethereum/go-ethereum/jsre" "github.com/robertkrimen/otto" @@ -42,6 +43,7 @@ func (self *Jeth) Send(call otto.FunctionCall) (response otto.Value) { var respif interface{} err = self.ethApi.GetRequestReply(&req, &respif) if err != nil { + fmt.Printf("error: %s\n", err) return self.err(-32603, err.Error(), req.Id) } self.re.Set("ret_jsonrpc", jsonrpcver) diff --git a/xeth/xeth.go b/xeth/xeth.go index 6c9db16c2..b203e45de 100644 --- a/xeth/xeth.go +++ b/xeth/xeth.go @@ -29,6 +29,9 @@ var ( defaultGas = big.NewInt(90000) //500000 ) +func DefaultGas() *big.Int { return new(big.Int).Set(defaultGas) } +func DefaultGasPrice() *big.Int { return new(big.Int).Set(defaultGasPrice) } + type XEth struct { backend *eth.Ethereum frontend Frontend @@ -130,9 +133,6 @@ func cTopics(t [][]string) [][]common.Hash { return topics } -func (self *XEth) DefaultGas() *big.Int { return new(big.Int).Set(defaultGas) } -func (self *XEth) DefaultGasPrice() *big.Int { return new(big.Int).Set(defaultGasPrice) } - func (self *XEth) RemoteMining() *miner.RemoteAgent { return self.agent } func (self *XEth) AtStateNum(num int64) *XEth { @@ -570,11 +570,11 @@ func (self *XEth) Call(fromStr, toStr, valueStr, gasStr, gasPriceStr, dataStr st } if msg.gas.Cmp(big.NewInt(0)) == 0 { - msg.gas = self.DefaultGas() + msg.gas = DefaultGas() } if msg.gasPrice.Cmp(big.NewInt(0)) == 0 { - msg.gasPrice = self.DefaultGasPrice() + msg.gasPrice = DefaultGasPrice() } block := self.CurrentBlock() @@ -620,11 +620,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 // common.Value conversions later on if gas.Cmp(big.NewInt(0)) == 0 { - gas = self.DefaultGas() + gas = DefaultGas() } if price.Cmp(big.NewInt(0)) == 0 { - price = self.DefaultGasPrice() + price = DefaultGasPrice() } data = common.FromHex(codeStr) |