aboutsummaryrefslogtreecommitdiffstats
path: root/trie/shortnode.go
diff options
context:
space:
mode:
Diffstat (limited to 'trie/shortnode.go')
-rw-r--r--trie/shortnode.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/trie/shortnode.go b/trie/shortnode.go
index edd490b4d..c86e50096 100644
--- a/trie/shortnode.go
+++ b/trie/shortnode.go
@@ -6,20 +6,22 @@ type ShortNode struct {
trie *Trie
key []byte
value Node
+ dirty bool
}
func NewShortNode(t *Trie, key []byte, value Node) *ShortNode {
- return &ShortNode{t, []byte(CompactEncode(key)), value}
+ return &ShortNode{t, []byte(CompactEncode(key)), value, false}
}
func (self *ShortNode) Value() Node {
self.value = self.trie.trans(self.value)
return self.value
}
-func (self *ShortNode) Dirty() bool { return true }
+func (self *ShortNode) Dirty() bool { return self.dirty }
func (self *ShortNode) Copy(t *Trie) Node {
- node := &ShortNode{t, nil, self.value.Copy(t)}
+ node := &ShortNode{t, nil, self.value.Copy(t), self.dirty}
node.key = common.CopyBytes(self.key)
+ node.dirty = true
return node
}
@@ -33,3 +35,7 @@ func (self *ShortNode) Hash() interface{} {
func (self *ShortNode) Key() []byte {
return CompactDecode(string(self.key))
}
+
+func (self *ShortNode) setDirty(dirty bool) {
+ self.dirty = dirty
+}