From b6e5fe8dbea5d898565863b38756b1bd6f47760d Mon Sep 17 00:00:00 2001 From: SomberNight Date: Mon, 12 Feb 2024 02:01:14 +0000 Subject: [PATCH] lnworker: history to include close tx for channel backups - scenario: - reuse same seed between two devices, LN enabled on both - open channel using device1, import chan backup on device2 - local-force-close channel using device1 - tx1 (ctx) gets into mempool (or even mined), tx2 (sweep tx for to_local) is a local (future) tx - history tab on device1 shows tx1 and tx2 - history tab on device2 was showing only tx2, and no info about tx1 - device2 knows about tx1, it was just not showing it previously. With this commit, tx1 is now shown in the history. - note: tx1 might linger in the mempool for an indeterminate amount of time, or even become local. During that time, it is confusing on device2 not to show any feedback. Also, if tx1 becomes local, it is useful to be able to rebroadcast it. --- electrum/lnworker.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/electrum/lnworker.py b/electrum/lnworker.py index 8b1353374..c907a279b 100644 --- a/electrum/lnworker.py +++ b/electrum/lnworker.py @@ -14,7 +14,6 @@ from typing import (Optional, Sequence, Tuple, List, Set, Dict, TYPE_CHECKING, NamedTuple, Union, Mapping, Any, Iterable, AsyncGenerator, DefaultDict, Callable, Awaitable) import threading import socket -import aiohttp import json from datetime import datetime, timezone from functools import partial, cached_property @@ -22,7 +21,9 @@ from collections import defaultdict import concurrent from concurrent import futures import urllib.parse +import itertools +import aiohttp import dns.resolver import dns.exception from aiorpcx import run_in_thread, NetAddress, ignore_after @@ -1063,7 +1064,7 @@ class LNWallet(LNWorker): current_height = self.wallet.adb.get_local_height() out = {} # add funding events - for chan in self.channels.values(): + for chan in itertools.chain(self.channels.values(), self.channel_backups.values()): # type: AbstractChannel item = chan.get_funding_height() if item is None: continue