logging
This commit is contained in:
parent
9dc6092cb0
commit
5de944146a
1 changed files with 18 additions and 5 deletions
|
@ -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.info(
|
lambda e: log.debug(
|
||||||
'(%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
|
||||||
)
|
)
|
||||||
|
@ -568,13 +568,26 @@ class Ledger(metaclass=LedgerRegistry):
|
||||||
await self.get_local_status_and_history(address, synced_history.getvalue())
|
await self.get_local_status_and_history(address, synced_history.getvalue())
|
||||||
if local_status != remote_status:
|
if local_status != remote_status:
|
||||||
if local_history == remote_history:
|
if local_history == remote_history:
|
||||||
return True
|
|
||||||
log.warning(
|
log.warning(
|
||||||
"Wallet is out of sync after syncing. Remote: %s with %d items, local: %s with %d items",
|
"%s has a synced history but a mismatched status", address
|
||||||
remote_status, len(remote_history), local_status, len(local_history)
|
)
|
||||||
|
return True
|
||||||
|
remote_set = set(remote_history)
|
||||||
|
local_set = set(local_history)
|
||||||
|
log.warning(
|
||||||
|
"%s is out of sync after syncing.\n"
|
||||||
|
"Remote: %s with %d items (%i unique), local: %s with %d items (%i unique).\n"
|
||||||
|
"Histories are mismatched on %i items.\n"
|
||||||
|
"Local is missing\n"
|
||||||
|
"%s\n"
|
||||||
|
"Remote is missing\n"
|
||||||
|
"%s\n"
|
||||||
|
"******",
|
||||||
|
address, remote_status, len(remote_history), len(remote_set),
|
||||||
|
local_status, len(local_history), len(local_set), len(remote_set.symmetric_difference(local_set)),
|
||||||
|
"\n".join([f"{txid} - {height}" for txid, height in local_set.difference(remote_set)]),
|
||||||
|
"\n".join([f"{txid} - {height}" for txid, height in remote_set.difference(local_set)])
|
||||||
)
|
)
|
||||||
log.warning("local: %s", local_history)
|
|
||||||
log.warning("remote: %s", remote_history)
|
|
||||||
self._known_addresses_out_of_sync.add(address)
|
self._known_addresses_out_of_sync.add(address)
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Add table
Reference in a new issue