diff options
author | obscuren <geffobscura@gmail.com> | 2015-04-09 06:44:20 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-04-09 06:44:20 +0800 |
commit | a9959805e572ec438bf31ea97cb4a52e0e9715e9 (patch) | |
tree | c8cd9e2318c5ad19aebad5c949066071e29b9668 /xeth | |
parent | 204ac81188e43900835c6aa5bad6b3e48f3a16d0 (diff) | |
download | dexon-a9959805e572ec438bf31ea97cb4a52e0e9715e9.tar dexon-a9959805e572ec438bf31ea97cb4a52e0e9715e9.tar.gz dexon-a9959805e572ec438bf31ea97cb4a52e0e9715e9.tar.bz2 dexon-a9959805e572ec438bf31ea97cb4a52e0e9715e9.tar.lz dexon-a9959805e572ec438bf31ea97cb4a52e0e9715e9.tar.xz dexon-a9959805e572ec438bf31ea97cb4a52e0e9715e9.tar.zst dexon-a9959805e572ec438bf31ea97cb4a52e0e9715e9.zip |
Removed from as a requirement and changed
Removed the from as a requiremet from the RPC eth_call. Xeth#Call now
also default values to:
1. Supplied account
2. First account if any
3. No managed account => 000000..00
Diffstat (limited to 'xeth')
-rw-r--r-- | xeth/xeth.go | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/xeth/xeth.go b/xeth/xeth.go index 94014763a..407fe69d5 100644 --- a/xeth/xeth.go +++ b/xeth/xeth.go @@ -572,8 +572,20 @@ func (self *XEth) PushTx(encodedTx string) (string, error) { func (self *XEth) Call(fromStr, toStr, valueStr, gasStr, gasPriceStr, dataStr string) (string, error) { statedb := self.State().State() //self.eth.ChainManager().TransState() + var from *state.StateObject + if len(fromStr) == 0 { + accounts, err := self.backend.AccountManager().Accounts() + if err != nil || len(accounts) == 0 { + from = statedb.GetOrNewStateObject(common.Address{}) + } else { + from = statedb.GetOrNewStateObject(common.BytesToAddress(accounts[0].Address)) + } + } else { + from = statedb.GetOrNewStateObject(common.HexToAddress(fromStr)) + } + msg := callmsg{ - from: statedb.GetOrNewStateObject(common.HexToAddress(fromStr)), + from: from, to: common.HexToAddress(toStr), gas: common.Big(gasStr), gasPrice: common.Big(gasPriceStr), |