1
0

call lnwatcher.trigger_callbacks in offline mode

This commit is contained in:
ThomasV
2025-05-19 13:20:25 +02:00
parent e1ac476bcf
commit b91c5d18cb
2 changed files with 8 additions and 2 deletions

View File

@@ -1077,7 +1077,8 @@ class Commands(Logger):
arg:int:year:Show history for a given year
"""
# trigger lnwatcher callbacks for their side effects: setting labels and accounting_addresses
await wallet.lnworker.lnwatcher.trigger_callbacks(requires_synchronizer=False)
if not self.network and wallet.lnworker:
await wallet.lnworker.lnwatcher.trigger_callbacks(requires_synchronizer=False)
#'from_height': (None, "Only show transactions that confirmed after given block height"),
#'to_height': (None, "Only show transactions that confirmed before given block height"),

View File

@@ -470,7 +470,12 @@ class Daemon(Logger):
if wallet := self._wallets.get(wallet_key):
return wallet
wallet = self._load_wallet(path, password, upgrade=upgrade, config=self.config)
wallet.start_network(self.network)
if self.network:
wallet.start_network(self.network)
elif wallet.lnworker:
# in offline mode, we need to trigger callbacks
coro = wallet.lnworker.lnwatcher.trigger_callbacks(requires_synchronizer=False)
asyncio.run_coroutine_threadsafe(coro, self.asyncio_loop)
self.add_wallet(wallet)
self.update_recently_opened_wallets(path)
return wallet