diff options
author | obscuren <geffobscura@gmail.com> | 2015-02-20 21:19:34 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-02-20 21:19:34 +0800 |
commit | ea9a549bbdc8377bca73f1417f2dc4a18396a382 (patch) | |
tree | f4f8719ad52f17b3db4b26626a9f5932870f9009 /state/statedb.go | |
parent | 5c975dd4ed7adb29453fa28e64c0193d323cae99 (diff) | |
download | dexon-ea9a549bbdc8377bca73f1417f2dc4a18396a382.tar dexon-ea9a549bbdc8377bca73f1417f2dc4a18396a382.tar.gz dexon-ea9a549bbdc8377bca73f1417f2dc4a18396a382.tar.bz2 dexon-ea9a549bbdc8377bca73f1417f2dc4a18396a382.tar.lz dexon-ea9a549bbdc8377bca73f1417f2dc4a18396a382.tar.xz dexon-ea9a549bbdc8377bca73f1417f2dc4a18396a382.tar.zst dexon-ea9a549bbdc8377bca73f1417f2dc4a18396a382.zip |
Removed exported fields from state object and added proper set/getters
Diffstat (limited to 'state/statedb.go')
-rw-r--r-- | state/statedb.go | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/state/statedb.go b/state/statedb.go index 8c8a21db9..7e2b24b94 100644 --- a/state/statedb.go +++ b/state/statedb.go @@ -72,7 +72,7 @@ func (self *StateDB) AddBalance(addr []byte, amount *big.Int) { func (self *StateDB) GetNonce(addr []byte) uint64 { stateObject := self.GetStateObject(addr) if stateObject != nil { - return stateObject.Nonce + return stateObject.nonce } return 0 @@ -81,7 +81,7 @@ func (self *StateDB) GetNonce(addr []byte) uint64 { func (self *StateDB) GetCode(addr []byte) []byte { stateObject := self.GetStateObject(addr) if stateObject != nil { - return stateObject.Code + return stateObject.code } return nil @@ -99,8 +99,7 @@ func (self *StateDB) GetState(a, b []byte) []byte { func (self *StateDB) SetNonce(addr []byte, nonce uint64) { stateObject := self.GetStateObject(addr) if stateObject != nil { - stateObject.Nonce = nonce - stateObject.dirty = true + stateObject.SetNonce(nonce) } } @@ -108,7 +107,6 @@ func (self *StateDB) SetCode(addr, code []byte) { stateObject := self.GetStateObject(addr) if stateObject != nil { stateObject.SetCode(code) - stateObject.dirty = true } } @@ -116,7 +114,6 @@ func (self *StateDB) SetState(addr, key []byte, value interface{}) { stateObject := self.GetStateObject(addr) if stateObject != nil { stateObject.SetState(key, ethutil.NewValue(value)) - stateObject.dirty = true } } @@ -124,7 +121,6 @@ func (self *StateDB) Delete(addr []byte) bool { stateObject := self.GetStateObject(addr) if stateObject != nil { stateObject.MarkForDeletion() - stateObject.dirty = true return true } @@ -141,7 +137,7 @@ func (self *StateDB) UpdateStateObject(stateObject *StateObject) { addr := stateObject.Address() if len(stateObject.CodeHash()) > 0 { - self.db.Put(stateObject.CodeHash(), stateObject.Code) + self.db.Put(stateObject.CodeHash(), stateObject.code) } self.trie.Update(addr, stateObject.RlpEncode()) |