Skip to content

Commit 949287b

Browse files
committed
Update to latest upstream LDK
1 parent f07d15b commit 949287b

File tree

2 files changed

+22
-30
lines changed

2 files changed

+22
-30
lines changed

Cargo.toml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,17 @@ default = []
5252
#lightning-liquidity = { git = "https://github.com/lightningdevkit/rust-lightning", branch = "main" }
5353
#lightning-macros = { git = "https://github.com/lightningdevkit/rust-lightning", branch = "main" }
5454

55-
lightning = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "b002e43ec5f9c1cbdcd1ac8588402c5a65ecd2e4", features = ["std"] }
56-
lightning-types = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "b002e43ec5f9c1cbdcd1ac8588402c5a65ecd2e4" }
57-
lightning-invoice = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "b002e43ec5f9c1cbdcd1ac8588402c5a65ecd2e4", features = ["std"] }
58-
lightning-net-tokio = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "b002e43ec5f9c1cbdcd1ac8588402c5a65ecd2e4" }
59-
lightning-persister = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "b002e43ec5f9c1cbdcd1ac8588402c5a65ecd2e4" }
60-
lightning-background-processor = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "b002e43ec5f9c1cbdcd1ac8588402c5a65ecd2e4" }
61-
lightning-rapid-gossip-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "b002e43ec5f9c1cbdcd1ac8588402c5a65ecd2e4" }
62-
lightning-block-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "b002e43ec5f9c1cbdcd1ac8588402c5a65ecd2e4", features = ["rest-client", "rpc-client", "tokio"] }
63-
lightning-transaction-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "b002e43ec5f9c1cbdcd1ac8588402c5a65ecd2e4", features = ["esplora-async-https", "electrum-rustls-ring", "time"] }
64-
lightning-liquidity = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "b002e43ec5f9c1cbdcd1ac8588402c5a65ecd2e4" }
65-
lightning-macros = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "b002e43ec5f9c1cbdcd1ac8588402c5a65ecd2e4" }
55+
lightning = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "1ed6c4b29abea431ac9296669c4ee0d093f0f7f0", features = ["std"] }
56+
lightning-types = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "1ed6c4b29abea431ac9296669c4ee0d093f0f7f0" }
57+
lightning-invoice = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "1ed6c4b29abea431ac9296669c4ee0d093f0f7f0", features = ["std"] }
58+
lightning-net-tokio = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "1ed6c4b29abea431ac9296669c4ee0d093f0f7f0" }
59+
lightning-persister = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "1ed6c4b29abea431ac9296669c4ee0d093f0f7f0" }
60+
lightning-background-processor = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "1ed6c4b29abea431ac9296669c4ee0d093f0f7f0" }
61+
lightning-rapid-gossip-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "1ed6c4b29abea431ac9296669c4ee0d093f0f7f0" }
62+
lightning-block-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "1ed6c4b29abea431ac9296669c4ee0d093f0f7f0", features = ["rest-client", "rpc-client", "tokio"] }
63+
lightning-transaction-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "1ed6c4b29abea431ac9296669c4ee0d093f0f7f0", features = ["esplora-async-https", "electrum-rustls-ring", "time"] }
64+
lightning-liquidity = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "1ed6c4b29abea431ac9296669c4ee0d093f0f7f0" }
65+
lightning-macros = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "1ed6c4b29abea431ac9296669c4ee0d093f0f7f0" }
6666

6767
#lightning = { path = "../rust-lightning/lightning", features = ["std"] }
6868
#lightning-types = { path = "../rust-lightning/lightning-types" }
@@ -109,7 +109,7 @@ winapi = { version = "0.3", features = ["winbase"] }
109109
[dev-dependencies]
110110
#lightning = { version = "0.1.0", features = ["std", "_test_utils"] }
111111
#lightning = { git = "https://github.com/lightningdevkit/rust-lightning", branch="main", features = ["std", "_test_utils"] }
112-
lightning = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "b002e43ec5f9c1cbdcd1ac8588402c5a65ecd2e4", features = ["std", "_test_utils"] }
112+
lightning = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "1ed6c4b29abea431ac9296669c4ee0d093f0f7f0", features = ["std", "_test_utils"] }
113113
#lightning = { path = "../rust-lightning/lightning", features = ["std", "_test_utils"] }
114114
proptest = "1.0.0"
115115
regex = "1.5.6"

src/payment/bolt12.rs

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use crate::payment::store::{PaymentDetails, PaymentDirection, PaymentKind, Payme
1717
use crate::types::{ChannelManager, PaymentStore};
1818

1919
use lightning::blinded_path::message::BlindedMessagePath;
20-
use lightning::ln::channelmanager::{PaymentId, Retry};
20+
use lightning::ln::channelmanager::{OptionalOfferPaymentParams, PaymentId, Retry};
2121
use lightning::offers::offer::{Amount, Offer as LdkOffer};
2222
use lightning::offers::parse::Bolt12SemanticError;
2323
use lightning::routing::router::RouteParametersConfig;
@@ -82,8 +82,6 @@ impl Bolt12Payment {
8282
let mut random_bytes = [0u8; 32];
8383
rand::thread_rng().fill_bytes(&mut random_bytes);
8484
let payment_id = PaymentId(random_bytes);
85-
let retry_strategy = Retry::Timeout(LDK_PAYMENT_RETRY_TIMEOUT);
86-
let route_params_config = RouteParametersConfig::default();
8785

8886
let offer_amount_msat = match offer.amount() {
8987
Some(Amount::Bitcoin { amount_msats }) => amount_msats,
@@ -97,15 +95,11 @@ impl Bolt12Payment {
9795
},
9896
};
9997

100-
match self.channel_manager.pay_for_offer(
101-
&offer,
102-
if offer.expects_quantity() { Some(1) } else { None },
103-
None,
104-
payer_note.clone(),
105-
payment_id,
106-
retry_strategy,
107-
route_params_config,
108-
) {
98+
let mut optional_params = OptionalOfferPaymentParams::default();
99+
optional_params.retry_strategy = Retry::Timeout(LDK_PAYMENT_RETRY_TIMEOUT);
100+
optional_params.payer_note = payer_note.clone();
101+
102+
match self.channel_manager.pay_for_offer(&offer, None, payment_id, optional_params) {
109103
Ok(()) => {
110104
let payee_pubkey = offer.issuer_signing_pubkey();
111105
log_info!(
@@ -183,8 +177,6 @@ impl Bolt12Payment {
183177
let mut random_bytes = [0u8; 32];
184178
rand::thread_rng().fill_bytes(&mut random_bytes);
185179
let payment_id = PaymentId(random_bytes);
186-
let retry_strategy = Retry::Timeout(LDK_PAYMENT_RETRY_TIMEOUT);
187-
let route_params_config = RouteParametersConfig::default();
188180

189181
let offer_amount_msat = match offer.amount() {
190182
Some(Amount::Bitcoin { amount_msats }) => amount_msats,
@@ -201,15 +193,15 @@ impl Bolt12Payment {
201193
"Failed to pay as the given amount needs to be at least the offer amount: required {}msat, gave {}msat.", offer_amount_msat, amount_msat);
202194
return Err(Error::InvalidAmount);
203195
}
196+
let mut optional_params = OptionalOfferPaymentParams::default();
197+
optional_params.retry_strategy = Retry::Timeout(LDK_PAYMENT_RETRY_TIMEOUT);
198+
optional_params.payer_note = payer_note.clone();
204199

205200
match self.channel_manager.pay_for_offer(
206201
&offer,
207-
if offer.expects_quantity() { Some(1) } else { None },
208202
Some(amount_msat),
209-
payer_note.clone(),
210203
payment_id,
211-
retry_strategy,
212-
route_params_config,
204+
optional_params,
213205
) {
214206
Ok(()) => {
215207
let payee_pubkey = offer.issuer_signing_pubkey();

0 commit comments

Comments
 (0)