diff options
Diffstat (limited to 'trie')
-rw-r--r-- | trie/cache.go | 6 | ||||
-rw-r--r-- | trie/trie.go | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/trie/cache.go b/trie/cache.go index 2705b0e45..99d8033a6 100644 --- a/trie/cache.go +++ b/trie/cache.go @@ -38,6 +38,8 @@ func NewCache(backend Backend) *Cache { } func (self *Cache) Get(key []byte) []byte { + key = append(StatePre, key...) + data := self.store[string(key)] if data == nil { data, _ = self.backend.Get(key) @@ -47,8 +49,8 @@ func (self *Cache) Get(key []byte) []byte { } func (self *Cache) Put(key []byte, data []byte) { - // write the data to the ldb batch - //self.batch.Put(key, rle.Compress(data)) + key = append(StatePre, key...) + self.batch.Put(key, data) self.store[string(key)] = data } diff --git a/trie/trie.go b/trie/trie.go index abf48a850..2970bc185 100644 --- a/trie/trie.go +++ b/trie/trie.go @@ -27,6 +27,8 @@ import ( "github.com/ethereum/go-ethereum/crypto" ) +var StatePre = []byte("state-") + func ParanoiaCheck(t1 *Trie, backend Backend) (bool, *Trie) { t2 := New(nil, backend) |