diff options
author | obscuren <geffobscura@gmail.com> | 2014-11-19 23:21:28 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-11-19 23:21:28 +0800 |
commit | 0f460ad26e864ae8b4c4cf99147c5b57a10f3be9 (patch) | |
tree | cd75d90107a450b02a36c0258bf404d2d2ddaaa7 /ptrie/fullnode.go | |
parent | e70529a97785012368e7e0d5b272cccab705e551 (diff) | |
download | go-tangerine-0f460ad26e864ae8b4c4cf99147c5b57a10f3be9.tar go-tangerine-0f460ad26e864ae8b4c4cf99147c5b57a10f3be9.tar.gz go-tangerine-0f460ad26e864ae8b4c4cf99147c5b57a10f3be9.tar.bz2 go-tangerine-0f460ad26e864ae8b4c4cf99147c5b57a10f3be9.tar.lz go-tangerine-0f460ad26e864ae8b4c4cf99147c5b57a10f3be9.tar.xz go-tangerine-0f460ad26e864ae8b4c4cf99147c5b57a10f3be9.tar.zst go-tangerine-0f460ad26e864ae8b4c4cf99147c5b57a10f3be9.zip |
Added caching and database interface to trie
* Reimplemented caching for trie
* Reimplemented resetting and persisting trie
Diffstat (limited to 'ptrie/fullnode.go')
-rw-r--r-- | ptrie/fullnode.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/ptrie/fullnode.go b/ptrie/fullnode.go index eaa4611b6..7a7f7d22d 100644 --- a/ptrie/fullnode.go +++ b/ptrie/fullnode.go @@ -18,7 +18,14 @@ func (self *FullNode) Branches() []Node { return self.nodes[:16] } -func (self *FullNode) Copy() Node { return self } +func (self *FullNode) Copy() Node { + nnode := NewFullNode(self.trie) + for i, node := range self.nodes { + nnode.nodes[i] = node + } + + return nnode +} // Returns the length of non-nil nodes func (self *FullNode) Len() (amount int) { |