Browse Source

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.
master
SomberNight 2 years ago
parent
commit
b6e5fe8dbe
No known key found for this signature in database
GPG Key ID: B33B5F232C6271E9
  1. 5
      electrum/lnworker.py

5
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) NamedTuple, Union, Mapping, Any, Iterable, AsyncGenerator, DefaultDict, Callable, Awaitable)
import threading import threading
import socket import socket
import aiohttp
import json import json
from datetime import datetime, timezone from datetime import datetime, timezone
from functools import partial, cached_property from functools import partial, cached_property
@ -22,7 +21,9 @@ from collections import defaultdict
import concurrent import concurrent
from concurrent import futures from concurrent import futures
import urllib.parse import urllib.parse
import itertools
import aiohttp
import dns.resolver import dns.resolver
import dns.exception import dns.exception
from aiorpcx import run_in_thread, NetAddress, ignore_after from aiorpcx import run_in_thread, NetAddress, ignore_after
@ -1063,7 +1064,7 @@ class LNWallet(LNWorker):
current_height = self.wallet.adb.get_local_height() current_height = self.wallet.adb.get_local_height()
out = {} out = {}
# add funding events # 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() item = chan.get_funding_height()
if item is None: if item is None:
continue continue

Loading…
Cancel
Save