From a27e2cc6b5893e3092d33bfc35ac90703b73e719 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Thu, 15 Jan 2026 16:43:22 +0000 Subject: [PATCH] addr_sync: update "stored_height" db field immediately on wallet-open Repro steps: - in qt gui, with network enabled, open wallet1 - open wizard, create wallet2 (restore from seed something that has mined history) - close both wallets, stop electrum - start electrum with "-o" offline flag, open wallet2 - observe all txs in history tab show up as "unconfirmed" The cause is that "stored_height" only gets updated ~on new blocks. So if you created a wallet and closed it soon, its db would not contain "stored_height." --- electrum/address_synchronizer.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/electrum/address_synchronizer.py b/electrum/address_synchronizer.py index dc9beddc1..9d061dd97 100644 --- a/electrum/address_synchronizer.py +++ b/electrum/address_synchronizer.py @@ -208,12 +208,13 @@ class AddressSynchronizer(Logger, EventListener): self.verifier = SPV(self.network, self) self.asyncio_loop = network.asyncio_loop self.register_callbacks() + self._update_stored_local_height() @event_listener @with_lock def on_event_blockchain_updated(self, *args): self.invalidate_cache() - self.db.put('stored_height', self.get_local_height()) + self._update_stored_local_height() async def stop(self): if self.network: @@ -694,6 +695,9 @@ class AddressSynchronizer(Logger, EventListener): return cached_local_height 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): """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).