Skip to content

Commit f894fad

Browse files
committed
f - Use u16 for LSPS2 cltv_expiry_delta and update rust-lightning rev
Align with upstream lightning-liquidity change that narrowed cltv_expiry_delta from u32 to u16, matching the BOLT 7 wire format. Co-Authored-By: HAL 9000
1 parent db9b5ae commit f894fad

File tree

2 files changed

+14
-21
lines changed

2 files changed

+14
-21
lines changed

Cargo.toml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -158,17 +158,17 @@ harness = false
158158
#lightning-macros = { git = "https://github.com/lightningdevkit/rust-lightning", branch = "main" }
159159

160160
[patch."https://github.com/lightningdevkit/rust-lightning"]
161-
lightning = { git = "https://github.com/tnull/rust-lightning", rev = "071aa74424bbb15079a7daa75d37ecaf22cca4f1" }
162-
lightning-types = { git = "https://github.com/tnull/rust-lightning", rev = "071aa74424bbb15079a7daa75d37ecaf22cca4f1" }
163-
lightning-invoice = { git = "https://github.com/tnull/rust-lightning", rev = "071aa74424bbb15079a7daa75d37ecaf22cca4f1" }
164-
lightning-net-tokio = { git = "https://github.com/tnull/rust-lightning", rev = "071aa74424bbb15079a7daa75d37ecaf22cca4f1" }
165-
lightning-persister = { git = "https://github.com/tnull/rust-lightning", rev = "071aa74424bbb15079a7daa75d37ecaf22cca4f1" }
166-
lightning-background-processor = { git = "https://github.com/tnull/rust-lightning", rev = "071aa74424bbb15079a7daa75d37ecaf22cca4f1" }
167-
lightning-rapid-gossip-sync = { git = "https://github.com/tnull/rust-lightning", rev = "071aa74424bbb15079a7daa75d37ecaf22cca4f1" }
168-
lightning-block-sync = { git = "https://github.com/tnull/rust-lightning", rev = "071aa74424bbb15079a7daa75d37ecaf22cca4f1" }
169-
lightning-transaction-sync = { git = "https://github.com/tnull/rust-lightning", rev = "071aa74424bbb15079a7daa75d37ecaf22cca4f1" }
170-
lightning-liquidity = { git = "https://github.com/tnull/rust-lightning", rev = "071aa74424bbb15079a7daa75d37ecaf22cca4f1" }
171-
lightning-macros = { git = "https://github.com/tnull/rust-lightning", rev = "071aa74424bbb15079a7daa75d37ecaf22cca4f1" }
161+
lightning = { git = "https://github.com/tnull/rust-lightning", rev = "733d3f25cd29cc9b114d3df2c9b0484dc73dbb8c" }
162+
lightning-types = { git = "https://github.com/tnull/rust-lightning", rev = "733d3f25cd29cc9b114d3df2c9b0484dc73dbb8c" }
163+
lightning-invoice = { git = "https://github.com/tnull/rust-lightning", rev = "733d3f25cd29cc9b114d3df2c9b0484dc73dbb8c" }
164+
lightning-net-tokio = { git = "https://github.com/tnull/rust-lightning", rev = "733d3f25cd29cc9b114d3df2c9b0484dc73dbb8c" }
165+
lightning-persister = { git = "https://github.com/tnull/rust-lightning", rev = "733d3f25cd29cc9b114d3df2c9b0484dc73dbb8c" }
166+
lightning-background-processor = { git = "https://github.com/tnull/rust-lightning", rev = "733d3f25cd29cc9b114d3df2c9b0484dc73dbb8c" }
167+
lightning-rapid-gossip-sync = { git = "https://github.com/tnull/rust-lightning", rev = "733d3f25cd29cc9b114d3df2c9b0484dc73dbb8c" }
168+
lightning-block-sync = { git = "https://github.com/tnull/rust-lightning", rev = "733d3f25cd29cc9b114d3df2c9b0484dc73dbb8c" }
169+
lightning-transaction-sync = { git = "https://github.com/tnull/rust-lightning", rev = "733d3f25cd29cc9b114d3df2c9b0484dc73dbb8c" }
170+
lightning-liquidity = { git = "https://github.com/tnull/rust-lightning", rev = "733d3f25cd29cc9b114d3df2c9b0484dc73dbb8c" }
171+
lightning-macros = { git = "https://github.com/tnull/rust-lightning", rev = "733d3f25cd29cc9b114d3df2c9b0484dc73dbb8c" }
172172

173173
#vss-client-ng = { path = "../vss-client" }
174174
#vss-client-ng = { git = "https://github.com/lightningdevkit/vss-client", branch = "main" }

src/liquidity.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ use crate::{total_anchor_channels_reserve_sats, Config, Error};
5252
const LIQUIDITY_REQUEST_TIMEOUT_SECS: u64 = 5;
5353

5454
const LSPS2_GETINFO_REQUEST_EXPIRY: Duration = Duration::from_secs(60 * 60 * 24);
55-
const LSPS2_CHANNEL_CLTV_EXPIRY_DELTA: u32 = 72;
55+
const LSPS2_CHANNEL_CLTV_EXPIRY_DELTA: u16 = 72;
5656

5757
struct LSPS1Client {
5858
lsp_node_id: PublicKey,
@@ -1407,14 +1407,7 @@ where
14071407
src_node_id: lsps2_client.lsp_node_id,
14081408
short_channel_id: buy_response.intercept_scid,
14091409
fees: RoutingFees { base_msat: 0, proportional_millionths: 0 },
1410-
cltv_expiry_delta: u16::try_from(buy_response.cltv_expiry_delta).map_err(|_| {
1411-
log_error!(
1412-
self.logger,
1413-
"Failed to create JIT invoice as LSPS2 CLTV delta {} exceeds supported range",
1414-
buy_response.cltv_expiry_delta
1415-
);
1416-
Error::LiquidityRequestFailed
1417-
})?,
1410+
cltv_expiry_delta: buy_response.cltv_expiry_delta,
14181411
htlc_minimum_msat: None,
14191412
htlc_maximum_msat: None,
14201413
}]);
@@ -1547,7 +1540,7 @@ pub(crate) struct LSPS2FeeResponse {
15471540
#[derive(Debug, Clone)]
15481541
pub(crate) struct LSPS2BuyResponse {
15491542
intercept_scid: u64,
1550-
cltv_expiry_delta: u32,
1543+
cltv_expiry_delta: u16,
15511544
}
15521545

15531546
/// A liquidity handler allowing to request channels via the [bLIP-51 / LSPS1] protocol.

0 commit comments

Comments
 (0)