forked from cerc-io/plugeth
Removed OOG check. Revert should always happen.
This commit is contained in:
parent
0e93b98533
commit
f5b8f3d41b
@ -129,7 +129,6 @@ done:
|
|||||||
statelogger.Infoln(err)
|
statelogger.Infoln(err)
|
||||||
erroneous = append(erroneous, tx)
|
erroneous = append(erroneous, tx)
|
||||||
err = nil
|
err = nil
|
||||||
continue
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,6 +214,7 @@ func (sm *BlockManager) ProcessWithParent(block, parent *types.Block) (td *big.I
|
|||||||
|
|
||||||
receiptSha := types.DeriveSha(receipts)
|
receiptSha := types.DeriveSha(receipts)
|
||||||
if bytes.Compare(receiptSha, block.ReceiptSha) != 0 {
|
if bytes.Compare(receiptSha, block.ReceiptSha) != 0 {
|
||||||
|
chainlogger.Debugln(receipts)
|
||||||
err = fmt.Errorf("validating receipt root. received=%x got=%x", block.ReceiptSha, receiptSha)
|
err = fmt.Errorf("validating receipt root. received=%x got=%x", block.ReceiptSha, receiptSha)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -56,9 +56,7 @@ func (self *Execution) exec(code, contextAddr []byte, caller vm.ClosureRef) (ret
|
|||||||
|
|
||||||
snapshot := env.State().Copy()
|
snapshot := env.State().Copy()
|
||||||
defer func() {
|
defer func() {
|
||||||
if vm.IsOOGErr(err) {
|
env.State().Set(snapshot)
|
||||||
env.State().Set(snapshot)
|
|
||||||
}
|
|
||||||
chainlogger.Debugf("post state %x\n", env.State().Root())
|
chainlogger.Debugf("post state %x\n", env.State().Root())
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
@ -189,12 +189,19 @@ func (self *StateTransition) TransitionState() (ret []byte, err error) {
|
|||||||
self.rec = MakeContract(msg, self.state)
|
self.rec = MakeContract(msg, self.state)
|
||||||
|
|
||||||
ret, err, ref = vmenv.Create(sender, self.rec.Address(), self.msg.Data(), self.gas, self.gasPrice, self.value)
|
ret, err, ref = vmenv.Create(sender, self.rec.Address(), self.msg.Data(), self.gas, self.gasPrice, self.value)
|
||||||
ref.SetCode(ret)
|
if err == nil {
|
||||||
|
dataGas := big.NewInt(int64(len(ret)))
|
||||||
|
dataGas.Mul(dataGas, vm.GasCreateByte)
|
||||||
|
if err = self.UseGas(dataGas); err == nil {
|
||||||
|
ref.SetCode(ret)
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
ret, err = vmenv.Call(self.From(), self.To().Address(), self.msg.Data(), self.gas, self.gasPrice, self.value)
|
ret, err = vmenv.Call(self.From(), self.To().Address(), self.msg.Data(), self.gas, self.gasPrice, self.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
statelogger.Debugln(err)
|
self.UseGas(self.gas)
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user