From fa60b9f9d3736d8055327f323386dda33d88d9f6 Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Tue, 16 Jun 2020 15:38:33 -0400 Subject: [PATCH] logging --- lbry/wallet/ledger.py | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/lbry/wallet/ledger.py b/lbry/wallet/ledger.py index beb5e3b1d..997a0dfeb 100644 --- a/lbry/wallet/ledger.py +++ b/lbry/wallet/ledger.py @@ -133,7 +133,7 @@ class Ledger(metaclass=LedgerRegistry): self._on_transaction_controller = StreamController() self.on_transaction = self._on_transaction_controller.stream self.on_transaction.listen( - lambda e: log.debug( + lambda e: log.info( '(%s) on_transaction: address=%s, height=%s, is_verified=%s, tx.id=%s', self.get_id(), e.address, e.tx.height, e.tx.is_verified, e.tx.id ) @@ -682,20 +682,26 @@ class Ledger(metaclass=LedgerRegistry): address_record['address'] )) for address_record in records ], timeout=1) - if pending: - records = await self.db.get_addresses(address__in=addresses) - for record in records: - found = False - local_history = (await self.get_local_status_and_history( - record['address'], history=record['history'] - ))[1] if record['history'] else [] - for txid, local_height in local_history: - if txid == tx.id and local_height >= height: - found = True - if not found: - log.debug("timeout: %s, %s, %s", record['history'], addresses, tx.id) + if not pending: + return True + records = await self.db.get_addresses(address__in=addresses) + for record in records: + local_history = (await self.get_local_status_and_history( + record['address'], history=record['history'] + ))[1] if record['history'] else [] + for txid, local_height in local_history: + if txid == tx.id: + if local_height >= height: + return True + log.warning( + "local history has higher height than remote for %s (%i vs %i)", txid, + local_height, height + ) return False - return True + log.warning( + "local history does not contain %s, requested height %i", tx.id, height + ) + return False async def _inflate_outputs( self, query, accounts,