diff options
author | obscuren <geffobscura@gmail.com> | 2015-02-03 11:58:34 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-02-03 11:58:34 +0800 |
commit | 3c7181d28f1f24aaea2da5cce664ffac52f369df (patch) | |
tree | 36e229ec95e89287e6d1add6ab587a90f8960041 /trie/cache.go | |
parent | 6fecb150d6f2bb36d3f1b7b9095cac428df2ce5a (diff) | |
download | go-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.go | 10 |
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) } |