mirror of
https://gitlab.com/pulsechaincom/go-pulse.git
synced 2024-12-26 05:17:19 +00:00
xeth: use same semantics as block processer for transient calls
This commit is contained in:
parent
260536a729
commit
ff99752ddd
@ -787,6 +787,7 @@ func (self *XEth) Call(fromStr, toStr, valueStr, gasStr, gasPriceStr, dataStr st
|
|||||||
from = statedb.GetOrNewStateObject(common.HexToAddress(fromStr))
|
from = statedb.GetOrNewStateObject(common.HexToAddress(fromStr))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
from.SetGasPool(self.backend.ChainManager().GasLimit())
|
||||||
msg := callmsg{
|
msg := callmsg{
|
||||||
from: from,
|
from: from,
|
||||||
to: common.HexToAddress(toStr),
|
to: common.HexToAddress(toStr),
|
||||||
@ -807,10 +808,8 @@ func (self *XEth) Call(fromStr, toStr, valueStr, gasStr, gasPriceStr, dataStr st
|
|||||||
block := self.CurrentBlock()
|
block := self.CurrentBlock()
|
||||||
vmenv := core.NewEnv(statedb, self.backend.ChainManager(), msg, block)
|
vmenv := core.NewEnv(statedb, self.backend.ChainManager(), msg, block)
|
||||||
|
|
||||||
initialGas := new(big.Int).Set(msg.gas)
|
res, gas, err := core.ApplyMessage(vmenv, msg, from)
|
||||||
res, err := vmenv.Call(msg.from, msg.to, msg.data, msg.gas, msg.gasPrice, msg.value)
|
return common.ToHex(res), gas.String(), err
|
||||||
|
|
||||||
return common.ToHex(res), initialGas.Sub(initialGas, msg.gas).String(), err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *XEth) ConfirmTransaction(tx string) bool {
|
func (self *XEth) ConfirmTransaction(tx string) bool {
|
||||||
|
Loading…
Reference in New Issue
Block a user