Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
bd7f129
lsps2: Move client into module directory
tnull Jul 16, 2026
2510be4
lsps2: Add single-use payment leases
tnull Jul 16, 2026
e83b5e9
lsps2: Persist payment leases
tnull Jul 16, 2026
fbf77ef
lsps2: Prune stale payment leases
tnull Jul 16, 2026
ff8c2fd
lsps2: Cache negotiated payment leases
tnull Jul 16, 2026
8ccc4e5
bolt11: Consume cached LSPS2 leases
tnull Jul 16, 2026
dae2feb
f Make lease consumption crash-safe
tnull Jul 16, 2026
ef4a115
deps: Use LSPS2 response APIs
tnull Jul 16, 2026
e783d4d
lsps2: Persist pending BOLT12 offers
tnull Jul 16, 2026
5a12583
bolt12: Register LSPS2 JIT offers
tnull Jul 16, 2026
2859a60
payment: Move payment metadata
tnull Jul 16, 2026
a35de09
bolt12: Add LSPS2 payment metadata
tnull Jul 16, 2026
9cddb04
bolt12: Install LSPS2 router
tnull Jul 16, 2026
332a403
lsps2: Share payment lease selection
tnull Jul 16, 2026
7cd5508
bolt12: Respond to requests from leases
tnull Jul 16, 2026
067860a
lsps2: Extend opening parameter validity
tnull Jul 16, 2026
7b21cff
bolt12: Validate LSPS2 opening fees
tnull Jul 16, 2026
3246e2e
lsps2: Serialize lease negotiation
tnull Jul 16, 2026
ee9e208
lsps2: Refill consumed payment leases
tnull Jul 16, 2026
bde343f
lsps2: Restore offer lease caches
tnull Jul 16, 2026
942cc80
lsps2: Retry failed lease negotiation
tnull Jul 16, 2026
f913605
bolt12: Address JIT offers by node ID
tnull Jul 16, 2026
f87460f
lsps2: Validate gross proportional fees
tnull Jul 16, 2026
81f0998
lsps2: Test BOLT12 JIT payments
tnull Jul 16, 2026
effe15f
lsps2: Test multi-LSP BOLT12 selection
tnull Jul 16, 2026
b02b5a9
lsps2: Test restored BOLT12 leases
tnull Jul 16, 2026
8d912f5
lsps2: Test BOLT12 after LSP restart
tnull Jul 16, 2026
5712376
lsps2: Fail over lease negotiation
tnull Jul 16, 2026
27c34ef
lsps2: Test payment lease state
tnull Jul 16, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -185,16 +185,16 @@ harness = false
#vss-client-ng = { path = "../vss-client" }
#vss-client-ng = { git = "https://github.com/lightningdevkit/vss-client", branch = "main" }
#
#[patch."https://github.com/lightningdevkit/rust-lightning"]
#lightning = { path = "../rust-lightning/lightning" }
#lightning-types = { path = "../rust-lightning/lightning-types" }
#lightning-invoice = { path = "../rust-lightning/lightning-invoice" }
[patch."https://github.com/lightningdevkit/rust-lightning"]
lightning = { git = "https://git.rust-bitcoin.org/tnull/rust-lightning", rev = "47dcb88874b11ddcf836bb294f861eb7bbf0d09b" }
lightning-types = { git = "https://git.rust-bitcoin.org/tnull/rust-lightning", rev = "47dcb88874b11ddcf836bb294f861eb7bbf0d09b" }
lightning-invoice = { git = "https://git.rust-bitcoin.org/tnull/rust-lightning", rev = "47dcb88874b11ddcf836bb294f861eb7bbf0d09b" }
#lightning-net-tokio = { path = "../rust-lightning/lightning-net-tokio" }
#lightning-persister = { path = "../rust-lightning/lightning-persister" }
#lightning-background-processor = { path = "../rust-lightning/lightning-background-processor" }
#lightning-rapid-gossip-sync = { path = "../rust-lightning/lightning-rapid-gossip-sync" }
#lightning-block-sync = { path = "../rust-lightning/lightning-block-sync" }
#lightning-transaction-sync = { path = "../rust-lightning/lightning-transaction-sync" }
#lightning-liquidity = { path = "../rust-lightning/lightning-liquidity" }
#lightning-macros = { path = "../rust-lightning/lightning-macros" }
lightning-liquidity = { git = "https://git.rust-bitcoin.org/tnull/rust-lightning", rev = "47dcb88874b11ddcf836bb294f861eb7bbf0d09b" }
lightning-macros = { git = "https://git.rust-bitcoin.org/tnull/rust-lightning", rev = "47dcb88874b11ddcf836bb294f861eb7bbf0d09b" }
#lightning-dns-resolver = { path = "../rust-lightning/lightning-dns-resolver" }
31 changes: 21 additions & 10 deletions src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ use lightning::util::persist::{
use lightning::util::ser::ReadableArgs;
use lightning::util::sweep::OutputSweeper;
use lightning_dns_resolver::OMDomainResolver;
use lightning_liquidity::lsps2::router::LSPS2Router;
use vss_client::headers::VssHeaderProvider;

use crate::chain::ChainSource;
Expand Down Expand Up @@ -74,6 +75,7 @@ use crate::lnurl_auth::LnurlAuth;
use crate::logger::{log_error, LdkLogger, LogLevel, LogWriter, Logger};
use crate::message_handler::NodeCustomMessageHandler;
use crate::payment::asynchronous::om_mailbox::OnionMessageMailbox;
use crate::payment::LSPS2PaymentMetadataDecoder;
use crate::peer_store::PeerStore;
use crate::probing::{
HighDegreeStrategy, Prober, ProbingConfig, ProbingStrategy, ProbingStrategyKind,
Expand Down Expand Up @@ -1900,15 +1902,20 @@ fn build_with_store_internal(
}

let scoring_fee_params = ProbabilisticScoringFeeParameters::default();
let router = Arc::new(DefaultRouter::new(
Arc::clone(&network_graph),
Arc::clone(&logger),
let router = Arc::new(LSPS2Router::new_with_payment_metadata_decoder(
DefaultRouter::new(
Arc::clone(&network_graph),
Arc::clone(&logger),
Arc::clone(&keys_manager),
Arc::clone(&scorer),
scoring_fee_params,
),
Arc::clone(&keys_manager),
Arc::clone(&scorer),
scoring_fee_params,
LSPS2PaymentMetadataDecoder,
));

let mut user_config = default_user_config(&config);
user_config.manually_handle_bolt12_invoice_requests = true;

if liquidity_source_config.and_then(|lsc| lsc.lsps2_service.as_ref()).is_some() {
// If we act as an LSPS2 service, we need to be able to intercept HTLCs and forward the
Expand Down Expand Up @@ -2270,12 +2277,16 @@ fn build_with_store_internal(
if let Some(penalty) = probing_cfg.diversity_penalty_msat {
probing_fee_params.probing_diversity_penalty_msat = penalty;
}
let probing_router = Arc::new(DefaultRouter::new(
Arc::clone(&network_graph),
Arc::clone(&logger),
let probing_router = Arc::new(LSPS2Router::new_with_payment_metadata_decoder(
DefaultRouter::new(
Arc::clone(&network_graph),
Arc::clone(&logger),
Arc::clone(&keys_manager),
Arc::clone(&scorer),
probing_fee_params,
),
Arc::clone(&keys_manager),
Arc::clone(&scorer),
probing_fee_params,
LSPS2PaymentMetadataDecoder,
));
Arc::new(HighDegreeStrategy::new(
Arc::clone(&network_graph),
Expand Down
9 changes: 9 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ 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;
const DEFAULT_PROBING_LIQUIDITY_LIMIT_MULTIPLIER: u64 = 3;
/// The default maximum number of pending BOLT12 LSPS2 offers.
pub const DEFAULT_LSPS2_PENDING_OFFER_CACHE_SIZE: usize = 100;
pub(crate) const DEFAULT_PROBING_INTERVAL_SECS: u64 = 10;
pub(crate) const MIN_PROBING_INTERVAL: Duration = Duration::from_millis(100);
pub(crate) const DEFAULT_PROBED_NODE_COOLDOWN_SECS: u64 = 60 * 60; // 1 hour
Expand Down Expand Up @@ -146,6 +148,7 @@ pub(crate) const LNURL_AUTH_TIMEOUT_SECS: u64 = 15;
/// | `probing_liquidity_limit_multiplier` | 3 |
/// | `anchor_channels_config` | AnchorChannelsConfig::default() |
/// | `route_parameters` | None |
/// | `lsps2_pending_offer_cache_size` | 100 |
/// | `tor_config` | None |
/// | `hrn_config` | HumanReadableNamesConfig::default() |
///
Expand Down Expand Up @@ -201,6 +204,11 @@ pub struct Config {
/// **Note:** If unset, default parameters will be used, and you will be able to override the
/// parameters on a per-payment basis in the corresponding method calls.
pub route_parameters: Option<RouteParametersConfig>,
/// The maximum number of BOLT12 offers using LSPS2 JIT channels that are retained for future
/// invoice requests. Once full, the least recently used offer is evicted.
///
/// Values below one are treated as one.
pub lsps2_pending_offer_cache_size: usize,
/// Configuration options for enabling peer connections via the Tor network.
///
/// Setting [`TorConfig`] enables connecting to peers with OnionV3 addresses. No other connections
Expand All @@ -226,6 +234,7 @@ impl Default for Config {
anchor_channels_config: AnchorChannelsConfig::default(),
tor_config: None,
route_parameters: None,
lsps2_pending_offer_cache_size: DEFAULT_LSPS2_PENDING_OFFER_CACHE_SIZE,
node_alias: None,
hrn_config: HumanReadableNamesConfig::default(),
}
Expand Down
Loading
Loading