[release/1.4.14] core, trie: replace state caches with trie journal

(cherry picked from commit cd791bd855)
This commit is contained in:
Felix Lange
2016-09-25 20:49:02 +02:00
committed by Péter Szilágyi
parent 7c17a6704c
commit ddadf402fc
15 changed files with 424 additions and 659 deletions

View File

@ -95,8 +95,6 @@ type Account struct {
Balance *big.Int
Root common.Hash // merkle root of the storage trie
CodeHash []byte
codeSize *int
}
// NewObject creates a state object.
@ -275,20 +273,9 @@ func (self *StateObject) Code(db trie.Database) []byte {
return code
}
// CodeSize returns the size of the contract code associated with this object.
func (self *StateObject) CodeSize(db trie.Database) int {
if self.data.codeSize == nil {
self.data.codeSize = new(int)
*self.data.codeSize = len(self.Code(db))
}
return *self.data.codeSize
}
func (self *StateObject) SetCode(code []byte) {
self.code = code
self.data.CodeHash = crypto.Keccak256(code)
self.data.codeSize = new(int)
*self.data.codeSize = len(code)
self.dirtyCode = true
if self.onDirty != nil {
self.onDirty(self.Address())