This commit is contained in:
Victor Shyba 2019-12-19 21:46:14 -03:00
parent 3e03dd3e80
commit 6652d55455

View file

@ -575,10 +575,7 @@ class BaseLedger(metaclass=LedgerRegistry):
# broadcast can't be a retriable call yet
return self.network.broadcast(hexlify(tx.raw).decode())
async def wait(self, tx: basetransaction.BaseTransaction, height=-1, timeout=1):
we_have = await self.get_transactions(txid=tx.id)
if we_have and we_have[0].height >= height:
return
async def wait(self, tx: basetransaction.BaseTransaction, height=-1, timeout=2):
addresses = set()
for txi in tx.inputs:
if txi.txo_ref.txo is not None:
@ -596,4 +593,12 @@ class BaseLedger(metaclass=LedgerRegistry):
)) for address_record in records
], timeout=timeout)
if pending:
raise asyncio.TimeoutError('Timed out waiting for transaction.')
for record in records:
found = False
_, local_history = await self.get_local_status_and_history(None, history=record['history'])
for txid, local_height in local_history:
if txid == tx.id and local_height >= height:
found = True
if not found:
print(record['history'], addresses, tx.id)
raise asyncio.TimeoutError('Timed out waiting for transaction: %s', tx.id)