From 581827080320ce08592925310982e22c189f488b Mon Sep 17 00:00:00 2001 From: zeppi Date: Tue, 5 Apr 2022 14:37:43 -0400 Subject: [PATCH 1/3] fix address_list pagination --- lbry/wallet/database.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lbry/wallet/database.py b/lbry/wallet/database.py index 2ddf9a666..1f7b2c0e4 100644 --- a/lbry/wallet/database.py +++ b/lbry/wallet/database.py @@ -1211,6 +1211,8 @@ class Database(SQLiteMixin): return addresses async def get_address_count(self, cols=None, read_only=False, **constraints): + # this is a count query that returns one line. Don't pass offset. + constraints.pop('offset') count = await self.select_addresses('COUNT(*) as total', read_only=read_only, **constraints) return count[0]['total'] or 0 From 2bd20882481e9b0784c9388515fdd5d52e26ef55 Mon Sep 17 00:00:00 2001 From: zeppi Date: Tue, 5 Apr 2022 14:52:12 -0400 Subject: [PATCH 2/3] bugfix --- lbry/wallet/database.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lbry/wallet/database.py b/lbry/wallet/database.py index 1f7b2c0e4..e3a4cf7a0 100644 --- a/lbry/wallet/database.py +++ b/lbry/wallet/database.py @@ -1212,7 +1212,8 @@ class Database(SQLiteMixin): async def get_address_count(self, cols=None, read_only=False, **constraints): # this is a count query that returns one line. Don't pass offset. - constraints.pop('offset') + if 'offset' in constraints: + constraints.pop('offset') count = await self.select_addresses('COUNT(*) as total', read_only=read_only, **constraints) return count[0]['total'] or 0 From 2d20458bc22e46cc9d06c7486c2a898813d5e711 Mon Sep 17 00:00:00 2001 From: Lex Berezhny Date: Wed, 6 Apr 2022 09:09:07 -0400 Subject: [PATCH 3/3] re-use existing constraints cleanup function --- lbry/wallet/database.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lbry/wallet/database.py b/lbry/wallet/database.py index e3a4cf7a0..48acebc5d 100644 --- a/lbry/wallet/database.py +++ b/lbry/wallet/database.py @@ -1211,9 +1211,7 @@ class Database(SQLiteMixin): return addresses async def get_address_count(self, cols=None, read_only=False, **constraints): - # this is a count query that returns one line. Don't pass offset. - if 'offset' in constraints: - constraints.pop('offset') + self._clean_txo_constraints_for_aggregation(constraints) count = await self.select_addresses('COUNT(*) as total', read_only=read_only, **constraints) return count[0]['total'] or 0