Skip to content

Commit 6fa70fc

Browse files
committed
Bump LDK dependencies to 0.3 fork
1 parent f23a307 commit 6fa70fc

3 files changed

Lines changed: 40 additions & 24 deletions

File tree

Cargo.toml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,18 @@ default = []
4040
#lightning-macros = { version = "0.2.0" }
4141
#lightning-dns-resolver = { version = "0.3.0" }
4242

43-
lightning = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "10608650d455f4d535cbac73921be329d814854a", features = ["std"] }
44-
lightning-types = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "10608650d455f4d535cbac73921be329d814854a" }
45-
lightning-invoice = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "10608650d455f4d535cbac73921be329d814854a", features = ["std"] }
46-
lightning-net-tokio = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "10608650d455f4d535cbac73921be329d814854a" }
47-
lightning-persister = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "10608650d455f4d535cbac73921be329d814854a", features = ["tokio"] }
48-
lightning-background-processor = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "10608650d455f4d535cbac73921be329d814854a" }
49-
lightning-rapid-gossip-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "10608650d455f4d535cbac73921be329d814854a" }
50-
lightning-block-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "10608650d455f4d535cbac73921be329d814854a", features = ["rest-client", "rpc-client", "tokio"] }
51-
lightning-transaction-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "10608650d455f4d535cbac73921be329d814854a", features = ["esplora-async-https", "time", "electrum-rustls-ring"] }
52-
lightning-liquidity = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "10608650d455f4d535cbac73921be329d814854a", features = ["std"] }
53-
lightning-macros = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "10608650d455f4d535cbac73921be329d814854a" }
54-
lightning-dns-resolver = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "10608650d455f4d535cbac73921be329d814854a" }
43+
lightning = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "090e09f3992694040d3a55c1c798b3a92fb77182", features = ["std"] }
44+
lightning-types = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "090e09f3992694040d3a55c1c798b3a92fb77182" }
45+
lightning-invoice = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "090e09f3992694040d3a55c1c798b3a92fb77182", features = ["std"] }
46+
lightning-net-tokio = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "090e09f3992694040d3a55c1c798b3a92fb77182" }
47+
lightning-persister = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "090e09f3992694040d3a55c1c798b3a92fb77182", features = ["tokio"] }
48+
lightning-background-processor = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "090e09f3992694040d3a55c1c798b3a92fb77182" }
49+
lightning-rapid-gossip-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "090e09f3992694040d3a55c1c798b3a92fb77182" }
50+
lightning-block-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "090e09f3992694040d3a55c1c798b3a92fb77182", features = ["rest-client", "rpc-client", "tokio"] }
51+
lightning-transaction-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "090e09f3992694040d3a55c1c798b3a92fb77182", features = ["esplora-async-https", "time", "electrum-rustls-ring"] }
52+
lightning-liquidity = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "090e09f3992694040d3a55c1c798b3a92fb77182", features = ["std"] }
53+
lightning-macros = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "090e09f3992694040d3a55c1c798b3a92fb77182" }
54+
lightning-dns-resolver = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "090e09f3992694040d3a55c1c798b3a92fb77182" }
5555

5656
bdk_chain = { version = "0.23.0", default-features = false, features = ["std"] }
5757
bdk_esplora = { version = "0.22.0", default-features = false, features = ["async-https-rustls", "tokio"]}
@@ -81,13 +81,13 @@ async-trait = { version = "0.1", default-features = false }
8181
vss-client = { package = "vss-client-ng", version = "0.5" }
8282
prost = { version = "0.11.6", default-features = false}
8383
#bitcoin-payment-instructions = { version = "0.6" }
84-
bitcoin-payment-instructions = { git = "https://github.com/jkczyz/bitcoin-payment-instructions", rev = "c7d7ea849fcbe8cad385c93f8057cd68ecb994b7" }
84+
bitcoin-payment-instructions = { git = "https://github.com/tnull/bitcoin-payment-instructions", rev = "ed8657dee284f987b6791cd291d0f0f18811ee76" }
8585

8686
[target.'cfg(windows)'.dependencies]
8787
winapi = { version = "0.3", features = ["winbase"] }
8888

8989
[dev-dependencies]
90-
lightning = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "10608650d455f4d535cbac73921be329d814854a", features = ["std", "_test_utils"] }
90+
lightning = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "090e09f3992694040d3a55c1c798b3a92fb77182", features = ["std", "_test_utils"] }
9191
rand = { version = "0.9.2", default-features = false, features = ["std", "thread_rng", "os_rng"] }
9292
proptest = "1.0.0"
9393
regex = "1.5.6"

src/liquidity.rs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1304,9 +1304,9 @@ where
13041304

13051305
// LSPS2 requires min_final_cltv_expiry_delta to be at least 2 more than usual.
13061306
let min_final_cltv_expiry_delta = MIN_FINAL_CLTV_EXPIRY_DELTA + 2;
1307-
let (payment_hash, payment_secret) = match payment_hash {
1307+
let (payment_hash, payment_secret, payment_metadata) = match payment_hash {
13081308
Some(payment_hash) => {
1309-
let payment_secret = self
1309+
let (payment_secret, payment_metadata) = self
13101310
.channel_manager
13111311
.create_inbound_payment_for_hash(
13121312
payment_hash,
@@ -1319,7 +1319,7 @@ where
13191319
log_error!(self.logger, "Failed to register inbound payment: {:?}", e);
13201320
Error::InvoiceCreationFailed
13211321
})?;
1322-
(payment_hash, payment_secret)
1322+
(payment_hash, payment_secret, payment_metadata)
13231323
},
13241324
None => self
13251325
.channel_manager
@@ -1353,15 +1353,21 @@ where
13531353
invoice_builder = invoice_builder.amount_milli_satoshis(amount_msat).basic_mpp();
13541354
}
13551355

1356-
invoice_builder
1357-
.build_signed(|hash| {
1356+
let invoice = if let Some(payment_metadata) = payment_metadata {
1357+
invoice_builder.payment_metadata(payment_metadata).build_signed(|hash| {
13581358
Secp256k1::new()
13591359
.sign_ecdsa_recoverable(hash, &self.keys_manager.get_node_secret_key())
13601360
})
1361-
.map_err(|e| {
1362-
log_error!(self.logger, "Failed to build and sign invoice: {}", e);
1363-
Error::InvoiceCreationFailed
1361+
} else {
1362+
invoice_builder.build_signed(|hash| {
1363+
Secp256k1::new()
1364+
.sign_ecdsa_recoverable(hash, &self.keys_manager.get_node_secret_key())
13641365
})
1366+
};
1367+
invoice.map_err(|e| {
1368+
log_error!(self.logger, "Failed to build and sign invoice: {}", e);
1369+
Error::InvoiceCreationFailed
1370+
})
13651371
}
13661372

13671373
pub(crate) async fn handle_channel_ready(

src/payment/bolt11.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,14 @@ impl Bolt11Payment {
119119
let preimage = if manual_claim_payment_hash.is_none() {
120120
// If the user hasn't registered a custom payment hash, we're positive ChannelManager
121121
// will know the preimage at this point.
122+
let mut payment_metadata = invoice.payment_metadata().cloned();
122123
let res = self
123124
.channel_manager
124-
.get_payment_preimage(payment_hash, payment_secret.clone(), None)
125+
.get_payment_preimage_decrypt_metadata(
126+
payment_hash,
127+
payment_secret.clone(),
128+
payment_metadata.as_deref_mut(),
129+
)
125130
.ok();
126131
debug_assert!(res.is_some(), "We just let ChannelManager create an inbound payment, it can't have forgotten the preimage by now.");
127132
res
@@ -206,9 +211,14 @@ impl Bolt11Payment {
206211
max_proportional_opening_fee_ppm_msat: lsp_prop_opening_fee,
207212
};
208213
let id = PaymentId(payment_hash.0);
214+
let mut payment_metadata = invoice.payment_metadata().cloned();
209215
let preimage = self
210216
.channel_manager
211-
.get_payment_preimage(payment_hash, payment_secret.clone(), None)
217+
.get_payment_preimage_decrypt_metadata(
218+
payment_hash,
219+
payment_secret.clone(),
220+
payment_metadata.as_deref_mut(),
221+
)
212222
.ok();
213223
let kind = PaymentKind::Bolt11Jit {
214224
hash: payment_hash,

0 commit comments

Comments
 (0)