aboutsummaryrefslogtreecommitdiffstats
path: root/ethstate/state.go
diff options
context:
space:
mode:
Diffstat (limited to 'ethstate/state.go')
-rw-r--r--ethstate/state.go19
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{} {