commit 35093434473ef4331c93d49d4220f0c56922b260
parent fc39295d20ee0ad90a944efb63369459a9cd9a19
Author: SomberNight <somber.night@protonmail.com>
Date: Tue, 9 Jun 2020 18:36:34 +0200
ln: make 'to_self_delay' CSV configurable
needed for tests
Diffstat:
3 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/electrum/lnpeer.py b/electrum/lnpeer.py
@@ -40,7 +40,7 @@ from .lnutil import (Outpoint, LocalConfig, RECEIVED, UpdateAddHtlc,
LOCAL, REMOTE, HTLCOwner, generate_keypair, LnKeyFamily,
ln_compare_features, privkey_to_pubkey, MIN_FINAL_CLTV_EXPIRY_ACCEPTED,
LightningPeerConnectionClosed, HandshakeFailed, NotFoundChanAnnouncementForUpdate,
- RemoteMisbehaving, DEFAULT_TO_SELF_DELAY,
+ RemoteMisbehaving,
NBLOCK_OUR_CLTV_EXPIRY_DELTA, format_short_channel_id, ShortChannelID,
IncompatibleLightningFeatures, derive_payment_secret_from_payment_preimage,
LN_MAX_FUNDING_SAT, calc_fees_for_commitment_tx)
@@ -503,7 +503,7 @@ class Peer(Logger):
local_config = LocalConfig.from_seed(
channel_seed=channel_seed,
static_remotekey=static_remotekey,
- to_self_delay=DEFAULT_TO_SELF_DELAY,
+ to_self_delay=self.network.config.get('lightning_to_self_delay', 7 * 144),
dust_limit_sat=bitcoin.DUST_LIMIT_DEFAULT_SAT_LEGACY,
max_htlc_value_in_flight_msat=funding_sat * 1000,
max_accepted_htlcs=5,
diff --git a/electrum/lnutil.py b/electrum/lnutil.py
@@ -282,8 +282,6 @@ class NotFoundChanAnnouncementForUpdate(Exception): pass
class PaymentFailure(UserFacingException): pass
# TODO make some of these values configurable?
-DEFAULT_TO_SELF_DELAY = 7 * 144
-
REDEEM_AFTER_DOUBLE_SPENT_DELAY = 30
CHANNEL_OPENING_TIMEOUT = 24*60*60
diff --git a/electrum/tests/regtest/regtest.sh b/electrum/tests/regtest/regtest.sh
@@ -79,9 +79,10 @@ if [[ $1 == "init" ]]; then
$agent -o init_lightning
$agent setconfig --offline log_to_file True
$agent setconfig --offline server 127.0.0.1:51001:t
+ $agent setconfig --offline lightning_to_self_delay 144
# alice is funded, bob is listening
if [[ $2 == "bob" ]]; then
- $bob setconfig --offline lightning_listen localhost:9735
+ $bob setconfig --offline lightning_listen localhost:9735
else
echo "funding $2"
$bitcoin_cli sendtoaddress $($agent getunusedaddress -o) 1