may be the sync fix

This commit is contained in:
Lex Berezhny 2018-12-05 23:42:16 -05:00
parent 4c854dd5a7
commit 367ffdea1f

View file

@ -91,6 +91,7 @@ class SynchronizationMonitor:
async def _monitor(self, coro): async def _monitor(self, coro):
task = self.loop.create_task(coro) task = self.loop.create_task(coro)
self.tasks.append(task) self.tasks.append(task)
log.info('sync tasks: %s', len(self.tasks))
try: try:
await task await task
finally: finally:
@ -418,7 +419,7 @@ class BaseLedger(metaclass=LedgerRegistry):
assert cache_item.tx is not None assert cache_item.tx is not None
txi.txo_ref = cache_item.tx.outputs[txi.txo_ref.position].ref txi.txo_ref = cache_item.tx.outputs[txi.txo_ref.position].ref
else: else:
check_db_for_txos.append(txi.txo_ref.tx_ref.id) check_db_for_txos.append(txi.txo_ref.id)
referenced_txos = { referenced_txos = {
txo.id: txo for txo in await self.db.get_txos(txoid__in=check_db_for_txos) txo.id: txo for txo in await self.db.get_txos(txoid__in=check_db_for_txos)
@ -427,7 +428,7 @@ class BaseLedger(metaclass=LedgerRegistry):
for txi in tx.inputs: for txi in tx.inputs:
if txi.txo_ref.txo is not None: if txi.txo_ref.txo is not None:
continue continue
referenced_txo = referenced_txos.get(txi.txo_ref.tx_ref.id) referenced_txo = referenced_txos.get(txi.txo_ref.id)
if referenced_txo is not None: if referenced_txo is not None:
txi.txo_ref = referenced_txo.ref txi.txo_ref = referenced_txo.ref