fix lower bound

This commit is contained in:
Jack Robison 2022-01-26 11:18:50 -05:00
parent fb4dc8342a
commit 7c46cc0805
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2
2 changed files with 1 additions and 5 deletions

View file

@ -77,11 +77,8 @@ class PrefixRow(metaclass=PrefixRowType):
else: else:
value_getter = lambda v: v value_getter = lambda v: v
lower_bound = None if not (start or prefix) else (
int.from_bytes(start or prefix, byteorder='big') - 1
).to_bytes(len(start or prefix), byteorder='big')
it = self._db.iterator( it = self._db.iterator(
start or prefix, self._column_family, iterate_lower_bound=lower_bound, start or prefix, self._column_family, iterate_lower_bound=(start or prefix),
iterate_upper_bound=stop, reverse=reverse, include_key=include_key, iterate_upper_bound=stop, reverse=reverse, include_key=include_key,
include_value=include_value, fill_cache=fill_cache, prefix_same_as_start=False include_value=include_value, fill_cache=fill_cache, prefix_same_as_start=False
) )

View file

@ -221,7 +221,6 @@ class TestRevertablePrefixDB(unittest.TestCase):
self.db.unsafe_commit() self.db.unsafe_commit()
def get_active_amount_as_of_height(claim_hash: bytes, height: int) -> int: def get_active_amount_as_of_height(claim_hash: bytes, height: int) -> int:
print(f"\t\tget_active_amount_as_of_height {claim_hash.hex()} @ {height}")
for v in self.db.active_amount.iterate( for v in self.db.active_amount.iterate(
start=(claim_hash, 1, 0), stop=(claim_hash, 1, height + 1), start=(claim_hash, 1, 0), stop=(claim_hash, 1, height + 1),
include_key=False, reverse=True): include_key=False, reverse=True):