diff --git a/lbry/wallet/server/db/prefixes.py b/lbry/wallet/server/db/prefixes.py index 10655138b..875900678 100644 --- a/lbry/wallet/server/db/prefixes.py +++ b/lbry/wallet/server/db/prefixes.py @@ -44,6 +44,8 @@ class PrefixRow(metaclass=PrefixRowType): def iterate(self, prefix=None, start=None, stop=None, reverse: bool = False, include_key: bool = True, include_value: bool = True): + if not prefix and not start and not stop: + prefix = () if prefix is not None: prefix = self.pack_partial_key(*prefix) if start is not None: diff --git a/lbry/wallet/server/leveldb.py b/lbry/wallet/server/leveldb.py index 34b669c81..3853fe7f3 100644 --- a/lbry/wallet/server/leveldb.py +++ b/lbry/wallet/server/leveldb.py @@ -851,11 +851,11 @@ class LevelDB: async def _read_claim_txos(self): def read_claim_txos(): - for _k, _v in self.db.iterator(prefix=Prefixes.claim_to_txo.prefix): - k = Prefixes.claim_to_txo.unpack_key(_k) - v = Prefixes.claim_to_txo.unpack_value(_v) - self.claim_to_txo[k.claim_hash] = v - self.txo_to_claim[(v.tx_num, v.position)] = k.claim_hash + set_txo_to_claim = self.txo_to_claim.__setitem__ + set_claim_to_txo = self.claim_to_txo.__setitem__ + for k, v in self.prefix_db.claim_to_txo.iterate(): + set_claim_to_txo(k.claim_hash, v) + set_txo_to_claim((v.tx_num, v.position), k.claim_hash) self.claim_to_txo.clear() self.txo_to_claim.clear()