aboutsummaryrefslogtreecommitdiffstats
path: root/trie/fullnode.go
diff options
context:
space:
mode:
Diffstat (limited to 'trie/fullnode.go')
-rw-r--r--trie/fullnode.go15
1 files changed, 8 insertions, 7 deletions
diff --git a/trie/fullnode.go b/trie/fullnode.go
index 522fdb373..95c8eb4be 100644
--- a/trie/fullnode.go
+++ b/trie/fullnode.go
@@ -1,17 +1,16 @@
package trie
-import "fmt"
-
type FullNode struct {
trie *Trie
nodes [17]Node
+ dirty bool
}
func NewFullNode(t *Trie) *FullNode {
return &FullNode{trie: t}
}
-func (self *FullNode) Dirty() bool { return true }
+func (self *FullNode) Dirty() bool { return self.dirty }
func (self *FullNode) Value() Node {
self.nodes[16] = self.trie.trans(self.nodes[16])
return self.nodes[16]
@@ -27,6 +26,7 @@ func (self *FullNode) Copy(t *Trie) Node {
nnode.nodes[i] = node.Copy(t)
}
}
+ nnode.dirty = true
return nnode
}
@@ -60,11 +60,8 @@ func (self *FullNode) RlpData() interface{} {
}
func (self *FullNode) set(k byte, value Node) {
- if _, ok := value.(*ValueNode); ok && k != 16 {
- fmt.Println(value, k)
- }
-
self.nodes[int(k)] = value
+ self.dirty = true
}
func (self *FullNode) branch(i byte) Node {
@@ -75,3 +72,7 @@ func (self *FullNode) branch(i byte) Node {
}
return nil
}
+
+func (self *FullNode) setDirty(dirty bool) {
+ self.dirty = dirty
+}