diff options
Diffstat (limited to 'core/block_processor.go')
-rw-r--r-- | core/block_processor.go | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/core/block_processor.go b/core/block_processor.go index 395622a8e..9fe74ef0a 100644 --- a/core/block_processor.go +++ b/core/block_processor.go @@ -78,21 +78,20 @@ func (self *BlockProcessor) ApplyTransaction(coinbase *state.StateObject, stated // If we are mining this block and validating we want to set the logs back to 0 statedb.EmptyLogs() - txGas := new(big.Int).Set(tx.Gas()) - cb := statedb.GetStateObject(coinbase.Address()) - st := NewStateTransition(NewEnv(statedb, self.bc, tx, block), tx, cb) - _, err := st.TransitionState() + /* + st := NewStateTransition(NewEnv(statedb, self.bc, tx, block), tx, cb) + _, err := st.TransitionState() + */ + _, gas, err := ApplyMessage(NewEnv(statedb, self.bc, tx, block), tx, cb) if err != nil && (IsNonceErr(err) || state.IsGasLimitErr(err) || IsInvalidTxErr(err)) { return nil, nil, err } - txGas.Sub(txGas, st.gas) - // Update the state with pending changes - statedb.Update(txGas) + statedb.Update(nil) - cumulative := new(big.Int).Set(usedGas.Add(usedGas, txGas)) + cumulative := new(big.Int).Set(usedGas.Add(usedGas, gas)) receipt := types.NewReceipt(statedb.Root(), cumulative) receipt.SetLogs(statedb.Logs()) receipt.Bloom = types.CreateBloom(types.Receipts{receipt}) @@ -105,7 +104,7 @@ func (self *BlockProcessor) ApplyTransaction(coinbase *state.StateObject, stated go self.eventMux.Post(logs) } - return receipt, txGas, err + return receipt, gas, err } func (self *BlockProcessor) ChainManager() *ChainManager { return self.bc |