aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2015-08-17 07:33:29 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2015-08-17 07:33:29 +0800
commitf6367548e4a28fcadbb6f669aa39d27109c07a56 (patch)
treef90a0850ef8b894d8fe06da69adeb0a60735bd43
parent59b28cfa311f7852ef9bd93ec64961b6c3a8d760 (diff)
parent1c3ca3ce6a20d559dd10506953333670575bf4e7 (diff)
downloaddexon-f6367548e4a28fcadbb6f669aa39d27109c07a56.tar
dexon-f6367548e4a28fcadbb6f669aa39d27109c07a56.tar.gz
dexon-f6367548e4a28fcadbb6f669aa39d27109c07a56.tar.bz2
dexon-f6367548e4a28fcadbb6f669aa39d27109c07a56.tar.lz
dexon-f6367548e4a28fcadbb6f669aa39d27109c07a56.tar.xz
dexon-f6367548e4a28fcadbb6f669aa39d27109c07a56.tar.zst
dexon-f6367548e4a28fcadbb6f669aa39d27109c07a56.zip
Merge pull request #1654 from obscuren/call-gas
xeth: call fix when doing 'create'-like calls
-rw-r--r--xeth/xeth.go14
1 files changed, 9 insertions, 5 deletions
diff --git a/xeth/xeth.go b/xeth/xeth.go
index 0ad0e507a..8bd45998f 100644
--- a/xeth/xeth.go
+++ b/xeth/xeth.go
@@ -822,18 +822,22 @@ func (self *XEth) Call(fromStr, toStr, valueStr, gasStr, gasPriceStr, dataStr st
}
from.SetBalance(common.MaxBig)
- from.SetGasLimit(self.backend.ChainManager().GasLimit())
+ from.SetGasLimit(common.MaxBig)
+
msg := callmsg{
from: from,
- to: common.HexToAddress(toStr),
gas: common.Big(gasStr),
gasPrice: common.Big(gasPriceStr),
value: common.Big(valueStr),
data: common.FromHex(dataStr),
}
+ if len(toStr) > 0 {
+ addr := common.HexToAddress(toStr)
+ msg.to = &addr
+ }
if msg.gas.Cmp(big.NewInt(0)) == 0 {
- msg.gas = DefaultGas()
+ msg.gas = big.NewInt(50000000)
}
if msg.gasPrice.Cmp(big.NewInt(0)) == 0 {
@@ -998,7 +1002,7 @@ func (self *XEth) sign(tx *types.Transaction, from common.Address, didUnlock boo
// callmsg is the message type used for call transations.
type callmsg struct {
from *state.StateObject
- to common.Address
+ to *common.Address
gas, gasPrice *big.Int
value *big.Int
data []byte
@@ -1007,7 +1011,7 @@ type callmsg struct {
// accessor boilerplate to implement core.Message
func (m callmsg) From() (common.Address, error) { return m.from.Address(), nil }
func (m callmsg) Nonce() uint64 { return m.from.Nonce() }
-func (m callmsg) To() *common.Address { return &m.to }
+func (m callmsg) To() *common.Address { return m.to }
func (m callmsg) GasPrice() *big.Int { return m.gasPrice }
func (m callmsg) Gas() *big.Int { return m.gas }
func (m callmsg) Value() *big.Int { return m.value }