trie: dirty tracking

This commit is contained in:
Jeffrey Wilcke
2015-07-01 15:38:32 +02:00
parent ab16ce70fc
commit 0a1ff68c11
7 changed files with 73 additions and 28 deletions

View File

@ -3,12 +3,13 @@ package trie
import "github.com/ethereum/go-ethereum/common"
type HashNode struct {
key []byte
trie *Trie
key []byte
trie *Trie
dirty bool
}
func NewHash(key []byte, trie *Trie) *HashNode {
return &HashNode{key, trie}
return &HashNode{key, trie, false}
}
func (self *HashNode) RlpData() interface{} {
@ -19,6 +20,10 @@ func (self *HashNode) Hash() interface{} {
return self.key
}
func (self *HashNode) setDirty(dirty bool) {
self.dirty = dirty
}
// These methods will never be called but we have to satisfy Node interface
func (self *HashNode) Value() Node { return nil }
func (self *HashNode) Dirty() bool { return true }