Merge pull request #10414 from SomberNight/202601_wallet_stored_height_fix
addr_sync: update "stored_height" db field immediately on wallet-open
This commit is contained in:
@@ -208,12 +208,13 @@ class AddressSynchronizer(Logger, EventListener):
|
|||||||
self.verifier = SPV(self.network, self)
|
self.verifier = SPV(self.network, self)
|
||||||
self.asyncio_loop = network.asyncio_loop
|
self.asyncio_loop = network.asyncio_loop
|
||||||
self.register_callbacks()
|
self.register_callbacks()
|
||||||
|
self._update_stored_local_height()
|
||||||
|
|
||||||
@event_listener
|
@event_listener
|
||||||
@with_lock
|
@with_lock
|
||||||
def on_event_blockchain_updated(self, *args):
|
def on_event_blockchain_updated(self, *args):
|
||||||
self.invalidate_cache()
|
self.invalidate_cache()
|
||||||
self.db.put('stored_height', self.get_local_height())
|
self._update_stored_local_height()
|
||||||
|
|
||||||
async def stop(self):
|
async def stop(self):
|
||||||
if self.network:
|
if self.network:
|
||||||
@@ -694,6 +695,9 @@ class AddressSynchronizer(Logger, EventListener):
|
|||||||
return cached_local_height
|
return cached_local_height
|
||||||
return self.network.get_local_height() if self.network else self.db.get('stored_height', 0)
|
return self.network.get_local_height() if self.network else self.db.get('stored_height', 0)
|
||||||
|
|
||||||
|
def _update_stored_local_height(self) -> None:
|
||||||
|
self.db.put('stored_height', self.get_local_height())
|
||||||
|
|
||||||
def set_future_tx(self, txid: str, *, wanted_height: int):
|
def set_future_tx(self, txid: str, *, wanted_height: int):
|
||||||
"""Mark a local tx as "future" (encumbered by a timelock).
|
"""Mark a local tx as "future" (encumbered by a timelock).
|
||||||
wanted_height is the min (abs) block height at which the tx can get into the mempool (be broadcast).
|
wanted_height is the min (abs) block height at which the tx can get into the mempool (be broadcast).
|
||||||
|
|||||||
Reference in New Issue
Block a user