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 /ethstate/state.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 'ethstate/state.go')
-rw-r--r-- | ethstate/state.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/ethstate/state.go b/ethstate/state.go index 97958cc0a..48efeae46 100644 --- a/ethstate/state.go +++ b/ethstate/state.go @@ -24,6 +24,8 @@ type State struct { manifest *Manifest refund map[string]*big.Int + + logs Logs } // Create a new state from a given trie @@ -31,6 +33,18 @@ func New(trie *ethtrie.Trie) *State { return &State{Trie: trie, stateObjects: make(map[string]*StateObject), manifest: NewManifest(), refund: make(map[string]*big.Int)} } +func (self *State) EmptyLogs() { + self.logs = nil +} + +func (self *State) AddLog(log Log) { + self.logs = append(self.logs, log) +} + +func (self *State) Logs() Logs { + return self.logs +} + // Retrieve the balance from the given address or 0 if object not found func (self *State) GetBalance(addr []byte) *big.Int { stateObject := self.GetStateObject(addr) @@ -202,6 +216,10 @@ func (self *State) Copy() *State { state.refund[addr] = refund } + logs := make(Logs, len(self.logs)) + copy(logs, self.logs) + state.logs = logs + return state } @@ -216,6 +234,7 @@ func (self *State) Set(state *State) { self.Trie = state.Trie self.stateObjects = state.stateObjects self.refund = state.refund + self.logs = state.logs } func (s *State) Root() interface{} { |