diff options
author | obscuren <geffobscura@gmail.com> | 2014-10-30 20:32:50 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-10-30 20:32:50 +0800 |
commit | df5603de0a34e80a1af6ad03e37ce43728baad35 (patch) | |
tree | 5d9a71ad887c243b781b1c2d6077336bed82057b /ethchain/state_manager.go | |
parent | fa890c8c0140dac1e02038a6134db0d83bb85af9 (diff) | |
download | dexon-df5603de0a34e80a1af6ad03e37ce43728baad35.tar dexon-df5603de0a34e80a1af6ad03e37ce43728baad35.tar.gz dexon-df5603de0a34e80a1af6ad03e37ce43728baad35.tar.bz2 dexon-df5603de0a34e80a1af6ad03e37ce43728baad35.tar.lz dexon-df5603de0a34e80a1af6ad03e37ce43728baad35.tar.xz dexon-df5603de0a34e80a1af6ad03e37ce43728baad35.tar.zst dexon-df5603de0a34e80a1af6ad03e37ce43728baad35.zip |
Moved logging to state, proper structured block
* Moved logs to state so it's subject to snapshotting
* Split up block header
* Removed logs from transactions and made them receipts only
Diffstat (limited to 'ethchain/state_manager.go')
-rw-r--r-- | ethchain/state_manager.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/ethchain/state_manager.go b/ethchain/state_manager.go index 0fe7001c6..62970f621 100644 --- a/ethchain/state_manager.go +++ b/ethchain/state_manager.go @@ -145,6 +145,9 @@ func (self *StateManager) ProcessTransactions(coinbase *ethstate.StateObject, st done: for i, tx := range txs { + // If we are mining this block and validating we want to set the logs back to 0 + state.EmptyLogs() + txGas := new(big.Int).Set(tx.Gas) cb := state.GetStateObject(coinbase.Address()) @@ -175,7 +178,7 @@ done: txGas.Sub(txGas, st.gas) cumulative := new(big.Int).Set(totalUsedGas.Add(totalUsedGas, txGas)) //receipt := &Receipt{tx, ethutil.CopyBytes(state.Root().([]byte)), accumelative} - receipt := &Receipt{ethutil.CopyBytes(state.Root().([]byte)), cumulative, LogsBloom(tx.logs).Bytes(), tx.logs} + receipt := &Receipt{ethutil.CopyBytes(state.Root().([]byte)), cumulative, LogsBloom(state.Logs()).Bytes(), state.Logs()} if i < len(block.Receipts()) { original := block.Receipts()[i] @@ -238,7 +241,7 @@ func (sm *StateManager) Process(block *Block) (err error) { txSha := DeriveSha(block.transactions) if bytes.Compare(txSha, block.TxSha) != 0 { - return fmt.Errorf("Error validating transaction sha. Received %x, got %x", block.ReceiptSha, txSha) + return fmt.Errorf("Error validating transaction sha. Received %x, got %x", block.TxSha, txSha) } receipts, err := sm.ApplyDiff(state, parent, block) |