aboutsummaryrefslogtreecommitdiffstats
path: root/trie/fullnode.go
diff options
context:
space:
mode:
authorJeffrey Wilcke <geffobscura@gmail.com>2015-07-01 21:38:32 +0800
committerJeffrey Wilcke <geffobscura@gmail.com>2015-07-04 08:51:36 +0800
commit0a1ff68c11706f60355b392cb16a681630260ac3 (patch)
treefa7e46110a346cc1a10e3a3135815942c4560859 /trie/fullnode.go
parentab16ce70fc68d9ab1b7d8cda57c180b4785cab6a (diff)
downloaddexon-0a1ff68c11706f60355b392cb16a681630260ac3.tar
dexon-0a1ff68c11706f60355b392cb16a681630260ac3.tar.gz
dexon-0a1ff68c11706f60355b392cb16a681630260ac3.tar.bz2
dexon-0a1ff68c11706f60355b392cb16a681630260ac3.tar.lz
dexon-0a1ff68c11706f60355b392cb16a681630260ac3.tar.xz
dexon-0a1ff68c11706f60355b392cb16a681630260ac3.tar.zst
dexon-0a1ff68c11706f60355b392cb16a681630260ac3.zip
trie: dirty tracking
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
+}