Browse Source

ln: make 'to_self_delay' CSV configurable

needed for tests
bip39-recovery
SomberNight 5 years ago
parent
commit
3509343447
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 4
      electrum/lnpeer.py
  2. 2
      electrum/lnutil.py
  3. 3
      electrum/tests/regtest/regtest.sh

4
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,

2
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

3
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

Loading…
Cancel
Save