Skip to content

Commit 43ebe0e

Browse files
committed
Update to upstream LDK after 4263 and 4370
lightningdevkit/rust-lightning#4263 and lightningdevkit/rust-lightning#4370 changed the `lightning` API, which we update to here.
1 parent fbc7f94 commit 43ebe0e

File tree

4 files changed

+46
-29
lines changed

4 files changed

+46
-29
lines changed

Cargo.toml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,17 @@ default = []
3939
#lightning-liquidity = { version = "0.2.0", features = ["std"] }
4040
#lightning-macros = { version = "0.2.0" }
4141

42-
lightning = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "7fe3268475551b0664d315bfbc860416ca8fc774", features = ["std"] }
43-
lightning-types = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "7fe3268475551b0664d315bfbc860416ca8fc774" }
44-
lightning-invoice = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "7fe3268475551b0664d315bfbc860416ca8fc774", features = ["std"] }
45-
lightning-net-tokio = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "7fe3268475551b0664d315bfbc860416ca8fc774" }
46-
lightning-persister = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "7fe3268475551b0664d315bfbc860416ca8fc774", features = ["tokio"] }
47-
lightning-background-processor = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "7fe3268475551b0664d315bfbc860416ca8fc774" }
48-
lightning-rapid-gossip-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "7fe3268475551b0664d315bfbc860416ca8fc774" }
49-
lightning-block-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "7fe3268475551b0664d315bfbc860416ca8fc774", features = ["rest-client", "rpc-client", "tokio"] }
50-
lightning-transaction-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "7fe3268475551b0664d315bfbc860416ca8fc774", features = ["esplora-async-https", "time", "electrum-rustls-ring"] }
51-
lightning-liquidity = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "7fe3268475551b0664d315bfbc860416ca8fc774", features = ["std"] }
52-
lightning-macros = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "7fe3268475551b0664d315bfbc860416ca8fc774" }
42+
lightning = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "35ab03fbe0fe0927a9242754a0797553f6f7f099", features = ["std"] }
43+
lightning-types = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "35ab03fbe0fe0927a9242754a0797553f6f7f099" }
44+
lightning-invoice = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "35ab03fbe0fe0927a9242754a0797553f6f7f099", features = ["std"] }
45+
lightning-net-tokio = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "35ab03fbe0fe0927a9242754a0797553f6f7f099" }
46+
lightning-persister = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "35ab03fbe0fe0927a9242754a0797553f6f7f099", features = ["tokio"] }
47+
lightning-background-processor = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "35ab03fbe0fe0927a9242754a0797553f6f7f099" }
48+
lightning-rapid-gossip-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "35ab03fbe0fe0927a9242754a0797553f6f7f099" }
49+
lightning-block-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "35ab03fbe0fe0927a9242754a0797553f6f7f099", features = ["rest-client", "rpc-client", "tokio"] }
50+
lightning-transaction-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "35ab03fbe0fe0927a9242754a0797553f6f7f099", features = ["esplora-async-https", "time", "electrum-rustls-ring"] }
51+
lightning-liquidity = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "35ab03fbe0fe0927a9242754a0797553f6f7f099", features = ["std"] }
52+
lightning-macros = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "35ab03fbe0fe0927a9242754a0797553f6f7f099" }
5353

5454
bdk_chain = { version = "0.23.0", default-features = false, features = ["std"] }
5555
bdk_esplora = { version = "0.22.0", default-features = false, features = ["async-https-rustls", "tokio"]}
@@ -78,13 +78,13 @@ log = { version = "0.4.22", default-features = false, features = ["std"]}
7878
vss-client = { package = "vss-client-ng", version = "0.4" }
7979
prost = { version = "0.11.6", default-features = false}
8080
#bitcoin-payment-instructions = { version = "0.6" }
81-
bitcoin-payment-instructions = { git = "https://github.com/tnull/bitcoin-payment-instructions", rev = "b9f9991b42e9d71b3ca966818a93b158cf8f6c40" }
81+
bitcoin-payment-instructions = { git = "https://github.com/tnull/bitcoin-payment-instructions", rev = "7ee3958834aba575e04b91a862f790d798a7d578" }
8282

8383
[target.'cfg(windows)'.dependencies]
8484
winapi = { version = "0.3", features = ["winbase"] }
8585

8686
[dev-dependencies]
87-
lightning = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "7fe3268475551b0664d315bfbc860416ca8fc774", features = ["std", "_test_utils"] }
87+
lightning = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "35ab03fbe0fe0927a9242754a0797553f6f7f099", features = ["std", "_test_utils"] }
8888
proptest = "1.0.0"
8989
regex = "1.5.6"
9090
criterion = { version = "0.7.0", features = ["async_tokio"] }

src/payment/bolt11.rs

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ use std::sync::{Arc, RwLock};
1414
use bitcoin::hashes::sha256::Hash as Sha256;
1515
use bitcoin::hashes::Hash;
1616
use lightning::ln::channelmanager::{
17-
Bolt11InvoiceParameters, Bolt11PaymentError, PaymentId, Retry, RetryableSendFailure,
17+
Bolt11InvoiceParameters, OptionalBolt11PaymentParams, PaymentId,
1818
};
19+
use lightning::ln::outbound_payment::{Bolt11PaymentError, Retry, RetryableSendFailure};
1920
use lightning::routing::router::{PaymentParameters, RouteParameters, RouteParametersConfig};
2021
use lightning_invoice::{
2122
Bolt11Invoice as LdkBolt11Invoice, Bolt11InvoiceDescription as LdkBolt11InvoiceDescription,
@@ -109,17 +110,21 @@ impl Bolt11Payment {
109110
}
110111
}
111112

112-
let route_parameters =
113+
let route_params_config =
113114
route_parameters.or(self.config.route_parameters).unwrap_or_default();
114115
let retry_strategy = Retry::Timeout(LDK_PAYMENT_RETRY_TIMEOUT);
115116
let payment_secret = Some(*invoice.payment_secret());
116117

118+
let optional_params = OptionalBolt11PaymentParams {
119+
retry_strategy,
120+
route_params_config,
121+
..Default::default()
122+
};
117123
match self.channel_manager.pay_for_bolt11_invoice(
118124
invoice,
119125
payment_id,
120126
None,
121-
route_parameters,
122-
retry_strategy,
127+
optional_params,
123128
) {
124129
Ok(()) => {
125130
let payee_pubkey = invoice.recover_payee_pub_key();
@@ -215,17 +220,21 @@ impl Bolt11Payment {
215220
}
216221
}
217222

218-
let route_parameters =
223+
let route_params_config =
219224
route_parameters.or(self.config.route_parameters).unwrap_or_default();
220225
let retry_strategy = Retry::Timeout(LDK_PAYMENT_RETRY_TIMEOUT);
221226
let payment_secret = Some(*invoice.payment_secret());
222227

228+
let optional_params = OptionalBolt11PaymentParams {
229+
retry_strategy,
230+
route_params_config,
231+
..Default::default()
232+
};
223233
match self.channel_manager.pay_for_bolt11_invoice(
224234
invoice,
225235
payment_id,
226236
Some(amount_msat),
227-
route_parameters,
228-
retry_strategy,
237+
optional_params,
229238
) {
230239
Ok(()) => {
231240
let payee_pubkey = invoice.recover_payee_pub_key();

src/payment/bolt12.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ use std::sync::{Arc, RwLock};
1414
use std::time::{Duration, SystemTime, UNIX_EPOCH};
1515

1616
use lightning::blinded_path::message::BlindedMessagePath;
17-
use lightning::ln::channelmanager::{OptionalOfferPaymentParams, PaymentId, Retry};
17+
use lightning::ln::channelmanager::{OptionalOfferPaymentParams, PaymentId};
18+
use lightning::ln::outbound_payment::Retry;
1819
use lightning::offers::offer::{Amount, Offer as LdkOffer, OfferFromHrn, Quantity};
1920
use lightning::offers::parse::Bolt12SemanticError;
2021
use lightning::routing::router::RouteParametersConfig;

src/payment/spontaneous.rs

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@
1010
use std::sync::{Arc, RwLock};
1111

1212
use bitcoin::secp256k1::PublicKey;
13-
use lightning::ln::channelmanager::{PaymentId, RecipientOnionFields, Retry, RetryableSendFailure};
13+
use lightning::ln::channelmanager::PaymentId;
14+
use lightning::ln::outbound_payment::{
15+
RecipientCustomTlvs, RecipientOnionFields, Retry, RetryableSendFailure,
16+
};
1417
use lightning::routing::router::{PaymentParameters, RouteParameters, RouteParametersConfig};
1518
use lightning::sign::EntropySource;
1619
use lightning_types::payment::{PaymentHash, PaymentPreimage};
@@ -125,15 +128,19 @@ impl SpontaneousPayment {
125128
*max_channel_saturation_power_of_half;
126129
}
127130

128-
let recipient_fields = match custom_tlvs {
129-
Some(tlvs) => RecipientOnionFields::spontaneous_empty()
130-
.with_custom_tlvs(tlvs.into_iter().map(|tlv| (tlv.type_num, tlv.value)).collect())
131-
.map_err(|e| {
132-
log_error!(self.logger, "Failed to send payment with custom TLVs: {:?}", e);
131+
let mut recipient_fields = RecipientOnionFields::spontaneous_empty();
132+
if let Some(tlvs) = custom_tlvs {
133+
let tlvs_vec = tlvs.into_iter().map(|tlv| (tlv.type_num, tlv.value)).collect();
134+
recipient_fields = recipient_fields.with_custom_tlvs(
135+
RecipientCustomTlvs::new(tlvs_vec).map_err(|()| {
136+
log_error!(
137+
self.logger,
138+
"Attempted to set payment custom TLVs to a spec-defined value"
139+
);
133140
Error::InvalidCustomTlvs
134141
})?,
135-
None => RecipientOnionFields::spontaneous_empty(),
136-
};
142+
);
143+
}
137144

138145
match self.channel_manager.send_spontaneous_payment(
139146
Some(payment_preimage),

0 commit comments

Comments
 (0)