diff options
author | obscuren <geffobscura@gmail.com> | 2014-08-15 22:19:10 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-08-15 22:19:10 +0800 |
commit | 7d95e8624a3bdca4a68b2a7ff6ed133264088cc1 (patch) | |
tree | 2509b79c2b24015e339132eb80e28773df0b106e /ethstate | |
parent | 2b9f71c6ca45929ccef844838c633aa0af5802be (diff) | |
download | dexon-7d95e8624a3bdca4a68b2a7ff6ed133264088cc1.tar.gz dexon-7d95e8624a3bdca4a68b2a7ff6ed133264088cc1.tar.zst dexon-7d95e8624a3bdca4a68b2a7ff6ed133264088cc1.zip |
Added message to closure && added change addresses
Diffstat (limited to 'ethstate')
-rw-r--r-- | ethstate/manifest.go | 30 | ||||
-rw-r--r-- | ethstate/state.go | 2 |
2 files changed, 8 insertions, 24 deletions
diff --git a/ethstate/manifest.go b/ethstate/manifest.go index 88ce673b9..604f77b89 100644 --- a/ethstate/manifest.go +++ b/ethstate/manifest.go @@ -10,38 +10,18 @@ import ( // The object manifest is used to keep changes to the state so we can keep track of the changes // that occurred during a state transitioning phase. type Manifest struct { - // XXX These will be handy in the future. Not important for now. - objectAddresses map[string]bool - storageAddresses map[string]map[string]bool - - ObjectChanges map[string]*StateObject - StorageChanges map[string]map[string]*big.Int - Messages Messages } func NewManifest() *Manifest { - m := &Manifest{objectAddresses: make(map[string]bool), storageAddresses: make(map[string]map[string]bool)} + m := &Manifest{} m.Reset() return m } func (m *Manifest) Reset() { - m.ObjectChanges = make(map[string]*StateObject) - m.StorageChanges = make(map[string]map[string]*big.Int) -} - -func (m *Manifest) AddObjectChange(stateObject *StateObject) { - m.ObjectChanges[string(stateObject.Address())] = stateObject -} - -func (m *Manifest) AddStorageChange(stateObject *StateObject, storageAddr []byte, storage *big.Int) { - if m.StorageChanges[string(stateObject.Address())] == nil { - m.StorageChanges[string(stateObject.Address())] = make(map[string]*big.Int) - } - - m.StorageChanges[string(stateObject.Address())][string(storageAddr)] = storage + m.Messages = nil } func (self *Manifest) AddMessage(msg *Message) *Message { @@ -61,6 +41,12 @@ type Message struct { Coinbase []byte Block []byte Number *big.Int + + ChangedAddresses [][]byte +} + +func (self *Message) AddStorageChange(addr []byte) { + self.ChangedAddresses = append(self.ChangedAddresses, addr) } func (self *Message) String() string { diff --git a/ethstate/state.go b/ethstate/state.go index 19210916e..cf060e795 100644 --- a/ethstate/state.go +++ b/ethstate/state.go @@ -60,8 +60,6 @@ func (self *State) UpdateStateObject(stateObject *StateObject) { ethutil.Config.Db.Put(ethcrypto.Sha3Bin(stateObject.Code), stateObject.Code) self.Trie.Update(string(addr), string(stateObject.RlpEncode())) - - self.manifest.AddObjectChange(stateObject) } // Delete the given state object and delete it from the state trie |