aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/state_transition.go2
-rw-r--r--rpc/api.go5
-rw-r--r--xeth/xeth.go20
3 files changed, 17 insertions, 10 deletions
diff --git a/core/state_transition.go b/core/state_transition.go
index b1c66d8c9..7659e3d50 100644
--- a/core/state_transition.go
+++ b/core/state_transition.go
@@ -199,6 +199,8 @@ func (self *StateTransition) TransitionState() (ret []byte, err error) {
dataGas.Mul(dataGas, vm.GasCreateByte)
if err := self.UseGas(dataGas); err == nil {
ref.SetCode(ret)
+ } else {
+ statelogger.Infoln("Insufficient gas for creating code. Require", dataGas, "and have", self.gas)
}
}
} else {
diff --git a/rpc/api.go b/rpc/api.go
index fb974883a..8bbe80bd8 100644
--- a/rpc/api.go
+++ b/rpc/api.go
@@ -21,8 +21,8 @@ import (
)
var (
- defaultGasPrice = big.NewInt(10000000000000)
- defaultGas = big.NewInt(50000)
+ defaultGasPrice = big.NewInt(150000000000)
+ defaultGas = big.NewInt(500000)
filterTickerTime = 15 * time.Second
)
@@ -252,7 +252,6 @@ func (p *EthereumApi) Transact(args *NewTxArgs, reply *interface{}) (err error)
*/
// TODO: align default values to have the same type, e.g. not depend on
// ethutil.Value conversions later on
- fmt.Println("gas", args.Gas)
if args.Gas.Cmp(big.NewInt(0)) == 0 {
args.Gas = defaultGas
}
diff --git a/xeth/xeth.go b/xeth/xeth.go
index 891a1e072..d8dd66aec 100644
--- a/xeth/xeth.go
+++ b/xeth/xeth.go
@@ -293,14 +293,12 @@ func (self *XEth) PushTx(encodedTx string) (string, error) {
return toHex(tx.Hash()), nil
}
-func (self *XEth) Call(fromStr, toStr, valueStr, gasStr, gasPriceStr, dataStr string) (string, error) {
- if len(gasStr) == 0 {
- gasStr = "100000"
- }
- if len(gasPriceStr) == 0 {
- gasPriceStr = "1"
- }
+var (
+ defaultGasPrice = big.NewInt(10000000000000)
+ defaultGas = big.NewInt(90000)
+)
+func (self *XEth) Call(fromStr, toStr, valueStr, gasStr, gasPriceStr, dataStr string) (string, error) {
statedb := self.State().State() //self.chainManager.TransState()
msg := callmsg{
from: statedb.GetOrNewStateObject(fromHex(fromStr)),
@@ -310,6 +308,14 @@ func (self *XEth) Call(fromStr, toStr, valueStr, gasStr, gasPriceStr, dataStr st
value: ethutil.Big(valueStr),
data: fromHex(dataStr),
}
+ if msg.gas.Cmp(big.NewInt(0)) == 0 {
+ msg.gas = defaultGas
+ }
+
+ if msg.gasPrice.Cmp(big.NewInt(0)) == 0 {
+ msg.gasPrice = defaultGasPrice
+ }
+
block := self.chainManager.CurrentBlock()
vmenv := core.NewEnv(statedb, self.chainManager, msg, block)