Merge pull request #96 from meshplus/fix/ledger-cache

fix(ledger): fix ledger query issue
This commit is contained in:
Aiden X 2020-06-21 22:34:02 +08:00 committed by GitHub
commit bedbc5be35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -153,6 +153,8 @@ func (o *Account) Query(prefix string) (bool, [][]byte) {
var ret [][]byte
stored := make(map[string][]byte)
cached := o.cache.query(o.Addr.Hex(), prefix)
begin, end := bytesPrefix(append(o.Addr.Bytes(), prefix...))
it := o.ldb.Iterator(begin, end)
@ -164,7 +166,6 @@ func (o *Account) Query(prefix string) (bool, [][]byte) {
stored[string(key)] = val
}
cached := o.cache.query(o.Addr.Hex(), prefix)
for key, val := range cached {
stored[key] = val
}