diff --git a/lbry/wallet/database.py b/lbry/wallet/database.py index 55a10b62b..ebf9745ef 100644 --- a/lbry/wallet/database.py +++ b/lbry/wallet/database.py @@ -1254,13 +1254,16 @@ class Database(SQLiteMixin): self.constrain_collections(constraints) return self.get_utxo_count(**constraints) - async def release_all_outputs(self, account): - await self.db.execute_fetchall( - "UPDATE txo SET is_reserved = 0 WHERE" - " is_reserved = 1 AND txo.address IN (" - " SELECT address from account_address WHERE account = ?" - " )", (account.public_key.address, ) - ) + async def release_all_outputs(self, account=None): + if account is None: + await self.db.execute_fetchall("UPDATE txo SET is_reserved = 0 WHERE is_reserved = 1") + else: + await self.db.execute_fetchall( + "UPDATE txo SET is_reserved = 0 WHERE" + " is_reserved = 1 AND txo.address IN (" + " SELECT address from account_address WHERE account = ?" + " )", (account.public_key.address, ) + ) def get_supports_summary(self, read_only=False, **constraints): return self.get_txos( diff --git a/lbry/wallet/ledger.py b/lbry/wallet/ledger.py index d1a5b69c3..86e3619c3 100644 --- a/lbry/wallet/ledger.py +++ b/lbry/wallet/ledger.py @@ -331,6 +331,7 @@ class Ledger(metaclass=LedgerRegistry): async with self._header_processing_lock: await self._update_tasks.add(self.initial_headers_sync()) await fully_synced + await self.db.release_all_outputs() await asyncio.gather(*(a.maybe_migrate_certificates() for a in self.accounts)) await asyncio.gather(*(a.save_max_gap() for a in self.accounts)) if len(self.accounts) > 10: