diff options
author | obscuren <geffobscura@gmail.com> | 2015-03-13 05:29:10 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-03-13 05:29:10 +0800 |
commit | 310ca62285d2d4aefed91efddefeac7e83b7671d (patch) | |
tree | 7ae305e8704daa5622f8a5ac470cc132a081d6b3 /core/block_processor.go | |
parent | 2ae90e1eba9dd98ea56c3b1ca38cb18fcfbbb622 (diff) | |
download | go-tangerine-310ca62285d2d4aefed91efddefeac7e83b7671d.tar go-tangerine-310ca62285d2d4aefed91efddefeac7e83b7671d.tar.gz go-tangerine-310ca62285d2d4aefed91efddefeac7e83b7671d.tar.bz2 go-tangerine-310ca62285d2d4aefed91efddefeac7e83b7671d.tar.lz go-tangerine-310ca62285d2d4aefed91efddefeac7e83b7671d.tar.xz go-tangerine-310ca62285d2d4aefed91efddefeac7e83b7671d.tar.zst go-tangerine-310ca62285d2d4aefed91efddefeac7e83b7671d.zip |
Removed some of that gas pre pay magic
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 |