aboutsummaryrefslogtreecommitdiffstats
path: root/trie/cache.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-02-03 11:58:34 +0800
committerobscuren <geffobscura@gmail.com>2015-02-03 11:58:34 +0800
commit3c7181d28f1f24aaea2da5cce664ffac52f369df (patch)
tree36e229ec95e89287e6d1add6ab587a90f8960041 /trie/cache.go
parent6fecb150d6f2bb36d3f1b7b9095cac428df2ce5a (diff)
downloadgo-tangerine-3c7181d28f1f24aaea2da5cce664ffac52f369df.tar.gz
go-tangerine-3c7181d28f1f24aaea2da5cce664ffac52f369df.tar.zst
go-tangerine-3c7181d28f1f24aaea2da5cce664ffac52f369df.zip
Fixed a copy issue in the trie which could cause a consensus failure
Diffstat (limited to 'trie/cache.go')
-rw-r--r--trie/cache.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/trie/cache.go b/trie/cache.go
index e03702b25..2143785fa 100644
--- a/trie/cache.go
+++ b/trie/cache.go
@@ -37,6 +37,14 @@ func (self *Cache) Flush() {
//self.Reset()
}
+func (self *Cache) Copy() *Cache {
+ cache := NewCache(self.backend)
+ for k, v := range self.store {
+ cache.store[k] = v
+ }
+ return cache
+}
+
func (self *Cache) Reset() {
- self.store = make(map[string][]byte)
+ //self.store = make(map[string][]byte)
}