core, eth, trie, xeth: merged state, chain, extra databases in one
This commit is contained in:
@ -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
|
||||
}
|
||||
|
@ -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)
|
||||
|
||||
|
Reference in New Issue
Block a user