Compare commits
3 commits
master
...
debug_bran
Author | SHA1 | Date | |
---|---|---|---|
|
c6419f199c | ||
|
5a3cd577db | ||
|
f5ccb8efdc |
2 changed files with 8 additions and 1 deletions
|
@ -483,6 +483,7 @@ class Ledger(metaclass=LedgerRegistry):
|
||||||
|
|
||||||
def process_status_update(self, update):
|
def process_status_update(self, update):
|
||||||
address, remote_status = update
|
address, remote_status = update
|
||||||
|
log.info("Server sent update for %s, processing.", address)
|
||||||
self._update_tasks.add(self.update_history(address, remote_status))
|
self._update_tasks.add(self.update_history(address, remote_status))
|
||||||
|
|
||||||
async def update_history(self, address, remote_status, address_manager: AddressManager = None):
|
async def update_history(self, address, remote_status, address_manager: AddressManager = None):
|
||||||
|
@ -640,6 +641,7 @@ class Ledger(metaclass=LedgerRegistry):
|
||||||
return self.network.broadcast(hexlify(tx.raw).decode())
|
return self.network.broadcast(hexlify(tx.raw).decode())
|
||||||
|
|
||||||
async def wait(self, tx: Transaction, height=-1, timeout=1):
|
async def wait(self, tx: Transaction, height=-1, timeout=1):
|
||||||
|
log.info("waiting for tx %s with timeout %s seconds", tx.id, timeout)
|
||||||
timeout = timeout or 600 # after 10 minutes there is almost 0 hope
|
timeout = timeout or 600 # after 10 minutes there is almost 0 hope
|
||||||
addresses = set()
|
addresses = set()
|
||||||
for txi in tx.inputs:
|
for txi in tx.inputs:
|
||||||
|
@ -653,6 +655,7 @@ class Ledger(metaclass=LedgerRegistry):
|
||||||
start = int(time.perf_counter())
|
start = int(time.perf_counter())
|
||||||
while timeout and (int(time.perf_counter()) - start) <= timeout:
|
while timeout and (int(time.perf_counter()) - start) <= timeout:
|
||||||
if await self._wait_round(tx, height, addresses):
|
if await self._wait_round(tx, height, addresses):
|
||||||
|
log.info("got reply for tx %s with timeout %s seconds", tx.id, timeout)
|
||||||
return
|
return
|
||||||
raise asyncio.TimeoutError('Timed out waiting for transaction.')
|
raise asyncio.TimeoutError('Timed out waiting for transaction.')
|
||||||
|
|
||||||
|
@ -675,7 +678,9 @@ class Ledger(metaclass=LedgerRegistry):
|
||||||
if txid == tx.id and local_height >= height:
|
if txid == tx.id and local_height >= height:
|
||||||
found = True
|
found = True
|
||||||
if not found:
|
if not found:
|
||||||
log.debug("timeout: %s, %s, %s", record['history'], addresses, tx.id)
|
log.info('forcing update on %s', record['address'])
|
||||||
|
self._update_tasks.add(self.update_history(record['address'], 'force'))
|
||||||
|
log.info("timeout: %s, %s, %s", record['history'], addresses, tx.id)
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
|
@ -298,7 +298,9 @@ class WalletManager:
|
||||||
|
|
||||||
async def broadcast_or_release(self, tx, blocking=False):
|
async def broadcast_or_release(self, tx, blocking=False):
|
||||||
try:
|
try:
|
||||||
|
log.info("broadcasting %s", tx.id)
|
||||||
await self.ledger.broadcast(tx)
|
await self.ledger.broadcast(tx)
|
||||||
|
log.info("broadcasted %s", tx.id)
|
||||||
if blocking:
|
if blocking:
|
||||||
await self.ledger.wait(tx, timeout=None)
|
await self.ledger.wait(tx, timeout=None)
|
||||||
except:
|
except:
|
||||||
|
|
Loading…
Add table
Reference in a new issue