diff options
author | Jeffrey Wilcke <geffobscura@gmail.com> | 2015-08-07 01:57:39 +0800 |
---|---|---|
committer | Jeffrey Wilcke <geffobscura@gmail.com> | 2015-08-08 04:29:02 +0800 |
commit | a23478c0be94e1e727a64d20341b8d6f98d7f0a0 (patch) | |
tree | 27020e2617acb8881332cac998965acdee6c2eb9 /trie | |
parent | d7580f21f65beaf896bfc004cf13d28ed87f2ae3 (diff) | |
download | dexon-a23478c0be94e1e727a64d20341b8d6f98d7f0a0.tar.gz dexon-a23478c0be94e1e727a64d20341b8d6f98d7f0a0.tar.zst dexon-a23478c0be94e1e727a64d20341b8d6f98d7f0a0.zip |
core, eth, trie, xeth: merged state, chain, extra databases in one
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) |