electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit c034219c5a31d09bcc183c5662f855799f112bb4
parent 1788e5c1c094390958ee91a74aa3f048ba1e9a0c
Author: SomberNight <somber.night@protonmail.com>
Date:   Mon, 11 May 2020 16:01:33 +0200

ln invoices: more relaxed filtering of chans to include route hints for

e.g. just because remote peer is temporarily offline, we might still want it
included in the invoice

Diffstat:
Melectrum/lnworker.py | 10++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/electrum/lnworker.py b/electrum/lnworker.py @@ -1216,19 +1216,21 @@ class LNWallet(LNWorker): """calculate routing hints (BOLT-11 'r' field)""" routing_hints = [] channels = list(self.channels.values()) + random.shuffle(channels) # not sure this has any benefit but let's not leak channel order scid_to_my_channels = {chan.short_channel_id: chan for chan in channels if chan.short_channel_id is not None} - ignore_min_htlc_value = False if amount_sat: amount_msat = 1000 * amount_sat else: # for no amt invoices, check if channel can receive at least 1 msat amount_msat = 1 - ignore_min_htlc_value = True # note: currently we add *all* our channels; but this might be a privacy leak? for chan in channels: - if not chan.can_receive(amount_msat=amount_msat, check_frozen=True, - ignore_min_htlc_value=ignore_min_htlc_value): + # do minimal filtering of channels. + # we include channels that cannot *right now* receive (e.g. peer disconnected or balance insufficient) + if not (chan.is_open() and not chan.is_frozen_for_receiving()): + continue + if amount_msat > 1000 * chan.constraints.capacity: continue chan_id = chan.short_channel_id assert isinstance(chan_id, bytes), chan_id