electrum

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

commit 762ebb12b253dd53517dbd99b13efcc0e0168b05
parent f397b315ac437d47e1583d3320c5c5058ba820f7
Author: SomberNight <somber.night@protonmail.com>
Date:   Fri,  5 Mar 2021 16:12:01 +0100

lnpeer: increase max_accepted_htlcs (5->30)

Counter-intuitively, the motivation is to be able to *send* more htlcs,
for MPP trickery. We don't offer more htlcs than this limit, to be
conservative with what we send, and to interoperate with clightning.

defaults of other clients:
eclair: 30
clightning: 30
lnd: 483

Diffstat:
Melectrum/lnchannel.py | 1+
Melectrum/lnpeer.py | 6+++++-
2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/electrum/lnchannel.py b/electrum/lnchannel.py @@ -781,6 +781,7 @@ class Channel(AbstractChannel): if len(self.hm.htlcs_by_direction(htlc_receiver, direction=RECEIVED, ctn=ctn)) + 1 > chan_config.max_accepted_htlcs: raise PaymentFailure('Too many HTLCs already in channel') # however, c-lightning is a lot stricter, so extra checks: + # https://github.com/ElementsProject/lightning/blob/4dcd4ca1556b13b6964a10040ba1d5ef82de4788/channeld/full_channel.c#L581 if strict: max_concurrent_htlcs = min(self.config[htlc_proposer].max_accepted_htlcs, self.config[htlc_receiver].max_accepted_htlcs) diff --git a/electrum/lnpeer.py b/electrum/lnpeer.py @@ -529,6 +529,10 @@ class Peer(Logger): static_remotekey = None dust_limit_sat = bitcoin.DUST_LIMIT_DEFAULT_SAT_LEGACY reserve_sat = max(funding_sat // 100, dust_limit_sat) + # for comparison of defaults, see + # https://github.com/ACINQ/eclair/blob/afa378fbb73c265da44856b4ad0f2128a88ae6c6/eclair-core/src/main/resources/reference.conf#L66 + # https://github.com/ElementsProject/lightning/blob/0056dd75572a8857cff36fcbdb1a2295a1ac9253/lightningd/options.c#L657 + # https://github.com/lightningnetwork/lnd/blob/56b61078c5b2be007d318673a5f3b40c6346883a/config.go#L81 local_config = LocalConfig.from_seed( channel_seed=channel_seed, static_remotekey=static_remotekey, @@ -536,7 +540,7 @@ class Peer(Logger): to_self_delay=self.network.config.get('lightning_to_self_delay', 7 * 144), dust_limit_sat=dust_limit_sat, max_htlc_value_in_flight_msat=funding_sat * 1000, - max_accepted_htlcs=5, + max_accepted_htlcs=30, initial_msat=initial_msat, reserve_sat=reserve_sat, funding_locked_received=False,