aboutsummaryrefslogtreecommitdiffstats
path: root/trie
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2015-08-09 20:16:37 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2015-08-09 20:16:37 +0800
commit2fcf7f1241648dc2c0ed90a122c5945f25b3ce1a (patch)
treee3e7d013e2ccae939df7dd1d8aa7dcb3802fadd7 /trie
parent07cb8092e7a41e80224dc63691146e8714f94ebf (diff)
parenta23478c0be94e1e727a64d20341b8d6f98d7f0a0 (diff)
downloaddexon-2fcf7f1241648dc2c0ed90a122c5945f25b3ce1a.tar
dexon-2fcf7f1241648dc2c0ed90a122c5945f25b3ce1a.tar.gz
dexon-2fcf7f1241648dc2c0ed90a122c5945f25b3ce1a.tar.bz2
dexon-2fcf7f1241648dc2c0ed90a122c5945f25b3ce1a.tar.lz
dexon-2fcf7f1241648dc2c0ed90a122c5945f25b3ce1a.tar.xz
dexon-2fcf7f1241648dc2c0ed90a122c5945f25b3ce1a.tar.zst
dexon-2fcf7f1241648dc2c0ed90a122c5945f25b3ce1a.zip
Merge pull request #1604 from obscuren/db-merge
core, eth, trie, xeth: merged state, chain, extra databases in one
Diffstat (limited to 'trie')
-rw-r--r--trie/cache.go6
-rw-r--r--trie/trie.go2
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)