This commit is contained in:
Jack Robison 2020-06-16 15:38:33 -04:00
parent 644120ca31
commit fa60b9f9d3
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2

View file

@ -133,7 +133,7 @@ class Ledger(metaclass=LedgerRegistry):
self._on_transaction_controller = StreamController() self._on_transaction_controller = StreamController()
self.on_transaction = self._on_transaction_controller.stream self.on_transaction = self._on_transaction_controller.stream
self.on_transaction.listen( 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', '(%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 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'] address_record['address']
)) for address_record in records )) for address_record in records
], timeout=1) ], timeout=1)
if pending: if not pending:
records = await self.db.get_addresses(address__in=addresses) return True
for record in records: records = await self.db.get_addresses(address__in=addresses)
found = False for record in records:
local_history = (await self.get_local_status_and_history( local_history = (await self.get_local_status_and_history(
record['address'], history=record['history'] record['address'], history=record['history']
))[1] if record['history'] else [] ))[1] if record['history'] else []
for txid, local_height in local_history: for txid, local_height in local_history:
if txid == tx.id and local_height >= height: if txid == tx.id:
found = True if local_height >= height:
if not found: return True
log.debug("timeout: %s, %s, %s", record['history'], addresses, tx.id) log.warning(
"local history has higher height than remote for %s (%i vs %i)", txid,
local_height, height
)
return False return False
return True log.warning(
"local history does not contain %s, requested height %i", tx.id, height
)
return False
async def _inflate_outputs( async def _inflate_outputs(
self, query, accounts, self, query, accounts,