Skip to content

Commit

Permalink
Drop default_cltv_expiry_delta
Browse files Browse the repository at this point in the history
.. as it was used for spontaneous payments only and hence a bit
misleading.

We drop it for now and see if any users would complain. If so, it would
probably be sufficient for it to be an optional parameter on the
spontaneous payments methods.
  • Loading branch information
tnull committed Aug 27, 2024
1 parent ca5b4dd commit 4419f46
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
1 change: 0 additions & 1 deletion bindings/ldk_node.udl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ dictionary Config {
string? log_dir_path;
Network network;
sequence<SocketAddress>? listening_addresses;
u32 default_cltv_expiry_delta;
u64 onchain_wallet_sync_interval_secs;
u64 wallet_sync_interval_secs;
u64 fee_rate_cache_update_interval_secs;
Expand Down
7 changes: 3 additions & 4 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ use std::time::Duration;
// Config defaults
const DEFAULT_STORAGE_DIR_PATH: &str = "/tmp/ldk_node/";
const DEFAULT_NETWORK: Network = Network::Bitcoin;
const DEFAULT_CLTV_EXPIRY_DELTA: u32 = 144;
const DEFAULT_BDK_WALLET_SYNC_INTERVAL_SECS: u64 = 80;
const DEFAULT_LDK_WALLET_SYNC_INTERVAL_SECS: u64 = 30;
const DEFAULT_FEE_RATE_CACHE_UPDATE_INTERVAL_SECS: u64 = 60 * 10;
Expand All @@ -33,6 +32,9 @@ pub(crate) const DEFAULT_ESPLORA_SERVER_URL: &str = "https://blockstream.info/ap
// The default Esplora client timeout we're using.
pub(crate) const DEFAULT_ESPLORA_CLIENT_TIMEOUT_SECS: u64 = 10;

// The default `final_cltv_expiry_delta` we apply when not set via the invoice.
pub(crate) const LDK_DEFAULT_FINAL_CLTV_EXPIRY_DELTA: u32 = 144;

// The timeout after which we abandon retrying failed payments.
pub(crate) const LDK_PAYMENT_RETRY_TIMEOUT: Duration = Duration::from_secs(10);

Expand Down Expand Up @@ -104,8 +106,6 @@ pub struct Config {
pub network: Network,
/// The addresses on which the node will listen for incoming connections.
pub listening_addresses: Option<Vec<SocketAddress>>,
/// The default CLTV expiry delta to be used for payments.
pub default_cltv_expiry_delta: u32,
/// The time in-between background sync attempts of the onchain wallet, in seconds.
///
/// **Note:** A minimum of 10 seconds is always enforced.
Expand Down Expand Up @@ -167,7 +167,6 @@ impl Default for Config {
log_dir_path: None,
network: DEFAULT_NETWORK,
listening_addresses: None,
default_cltv_expiry_delta: DEFAULT_CLTV_EXPIRY_DELTA,
onchain_wallet_sync_interval_secs: DEFAULT_BDK_WALLET_SYNC_INTERVAL_SECS,
wallet_sync_interval_secs: DEFAULT_LDK_WALLET_SYNC_INTERVAL_SECS,
fee_rate_cache_update_interval_secs: DEFAULT_FEE_RATE_CACHE_UPDATE_INTERVAL_SECS,
Expand Down
7 changes: 3 additions & 4 deletions src/payment/spontaneous.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Holds a payment handler allowing to send spontaneous ("keysend") payments.
use crate::config::{Config, LDK_PAYMENT_RETRY_TIMEOUT};
use crate::config::{Config, LDK_DEFAULT_FINAL_CLTV_EXPIRY_DELTA, LDK_PAYMENT_RETRY_TIMEOUT};
use crate::error::Error;
use crate::logger::{log_error, log_info, FilesystemLogger, Logger};
use crate::payment::store::{
Expand Down Expand Up @@ -68,7 +68,7 @@ impl SpontaneousPayment {
}

let mut route_params = RouteParameters::from_payment_params_and_value(
PaymentParameters::from_node_id(node_id, self.config.default_cltv_expiry_delta),
PaymentParameters::from_node_id(node_id, LDK_DEFAULT_FINAL_CLTV_EXPIRY_DELTA),
amount_msat,
);

Expand Down Expand Up @@ -153,13 +153,12 @@ impl SpontaneousPayment {
}

let liquidity_limit_multiplier = Some(self.config.probing_liquidity_limit_multiplier);
let cltv_expiry_delta = self.config.default_cltv_expiry_delta;

self.channel_manager
.send_spontaneous_preflight_probes(
node_id,
amount_msat,
cltv_expiry_delta,
LDK_DEFAULT_FINAL_CLTV_EXPIRY_DELTA,
liquidity_limit_multiplier,
)
.map_err(|e| {
Expand Down

0 comments on commit 4419f46

Please sign in to comment.