1
0

wallet: (fix) cannot just piggyback on adb.is_up_to_date()

The wallet needs its own up_to_date logic:
- the adb being up_to_date means all its addresses are synced
- but an HD wallet might decide to roll the gap limit and generate new addresses
  - the adb does not know about this...
  - the wallet should be considered *not* up_to_date
- relatedly, it is now the wallet that decides to reset the network request counters

- note that wallet.main() was never cleaned up previously.
  - now wallet gets its own taskgroup, which is cleaned up in wallet.stop.

Follow-up to adb refactor: 121d8732f1
This commit is contained in:
SomberNight
2022-06-10 18:55:55 +02:00
parent 0fa28eb3d2
commit 29d8d8de26
2 changed files with 53 additions and 25 deletions

View File

@@ -672,12 +672,6 @@ class AddressSynchronizer(Logger):
with self.lock:
status_changed = self._up_to_date != up_to_date
self._up_to_date = up_to_date
# reset sync state progress indicator
if up_to_date:
if self.synchronizer:
self.synchronizer.reset_request_counters()
if self.verifier:
self.verifier.reset_request_counters()
# fire triggers
util.trigger_callback('adb_set_up_to_date', self)
if status_changed:
@@ -686,6 +680,12 @@ class AddressSynchronizer(Logger):
def is_up_to_date(self):
return self._up_to_date
def reset_netrequest_counters(self) -> None:
if self.synchronizer:
self.synchronizer.reset_request_counters()
if self.verifier:
self.verifier.reset_request_counters()
def get_history_sync_state_details(self) -> Tuple[int, int]:
nsent, nans = 0, 0
if self.synchronizer: