aboutsummaryrefslogtreecommitdiffstats
path: root/ethchain/state_manager.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-10-30 20:32:50 +0800
committerobscuren <geffobscura@gmail.com>2014-10-30 20:32:50 +0800
commitdf5603de0a34e80a1af6ad03e37ce43728baad35 (patch)
tree5d9a71ad887c243b781b1c2d6077336bed82057b /ethchain/state_manager.go
parentfa890c8c0140dac1e02038a6134db0d83bb85af9 (diff)
downloaddexon-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.go7
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)