Skip to content

Commit 76f59ae

Browse files
Matt Coralloclaude
andcommitted
DROPME: Bump Rust Lightning to unmerged LSPS2 APIs
Point the Rust Lightning overrides at the local branch carrying the LSPS2 BOLT12 router changes and carry the temporary API updates needed to compile LDK Node. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 5ad916c commit 76f59ae

13 files changed

Lines changed: 62 additions & 52 deletions

File tree

Cargo.toml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -183,16 +183,16 @@ harness = false
183183
#vss-client-ng = { path = "../vss-client" }
184184
#vss-client-ng = { git = "https://github.com/lightningdevkit/vss-client", branch = "main" }
185185
#
186-
#[patch."https://github.com/lightningdevkit/rust-lightning"]
187-
#lightning = { path = "../rust-lightning/lightning" }
188-
#lightning-types = { path = "../rust-lightning/lightning-types" }
189-
#lightning-invoice = { path = "../rust-lightning/lightning-invoice" }
190-
#lightning-net-tokio = { path = "../rust-lightning/lightning-net-tokio" }
191-
#lightning-persister = { path = "../rust-lightning/lightning-persister" }
192-
#lightning-background-processor = { path = "../rust-lightning/lightning-background-processor" }
193-
#lightning-rapid-gossip-sync = { path = "../rust-lightning/lightning-rapid-gossip-sync" }
194-
#lightning-block-sync = { path = "../rust-lightning/lightning-block-sync" }
195-
#lightning-transaction-sync = { path = "../rust-lightning/lightning-transaction-sync" }
196-
#lightning-liquidity = { path = "../rust-lightning/lightning-liquidity" }
197-
#lightning-macros = { path = "../rust-lightning/lightning-macros" }
198-
#lightning-dns-resolver = { path = "../rust-lightning/lightning-dns-resolver" }
186+
[patch."https://github.com/lightningdevkit/rust-lightning"]
187+
lightning = { path = "../rust-lightning-3/lightning" }
188+
lightning-types = { path = "../rust-lightning-3/lightning-types" }
189+
lightning-invoice = { path = "../rust-lightning-3/lightning-invoice" }
190+
lightning-net-tokio = { path = "../rust-lightning-3/lightning-net-tokio" }
191+
lightning-persister = { path = "../rust-lightning-3/lightning-persister" }
192+
lightning-background-processor = { path = "../rust-lightning-3/lightning-background-processor" }
193+
lightning-rapid-gossip-sync = { path = "../rust-lightning-3/lightning-rapid-gossip-sync" }
194+
lightning-block-sync = { path = "../rust-lightning-3/lightning-block-sync" }
195+
lightning-transaction-sync = { path = "../rust-lightning-3/lightning-transaction-sync" }
196+
lightning-liquidity = { path = "../rust-lightning-3/lightning-liquidity" }
197+
lightning-macros = { path = "../rust-lightning-3/lightning-macros" }
198+
lightning-dns-resolver = { path = "../rust-lightning-3/lightning-dns-resolver" }

src/builder.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1916,6 +1916,7 @@ fn build_with_store_internal(
19161916
Arc::clone(&channel_manager),
19171917
Arc::clone(&om_resolver),
19181918
IgnoringMessageHandler {},
1919+
false,
19191920
))
19201921
} else {
19211922
Arc::new(OnionMessenger::new(

src/data_store.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ where
218218

219219
#[cfg(test)]
220220
mod tests {
221-
use lightning::impl_writeable_tlv_based;
221+
use lightning::impl_ser_tlv_based;
222222
use lightning::util::test_utils::TestLogger;
223223

224224
use super::*;
@@ -236,7 +236,7 @@ mod tests {
236236
hex_utils::to_string(&self.id)
237237
}
238238
}
239-
impl_writeable_tlv_based!(TestObjectId, { (0, id, required) });
239+
impl_ser_tlv_based!(TestObjectId, { (0, id, required) });
240240

241241
struct TestObjectUpdate {
242242
id: TestObjectId,
@@ -276,7 +276,7 @@ mod tests {
276276
}
277277
}
278278

279-
impl_writeable_tlv_based!(TestObject, {
279+
impl_ser_tlv_based!(TestObject, {
280280
(0, id, required),
281281
(2, data, required),
282282
});

src/event.rs

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use lightning::util::config::{ChannelConfigOverrides, ChannelConfigUpdate};
2929
use lightning::util::errors::APIError;
3030
use lightning::util::persist::KVStore;
3131
use lightning::util::ser::{Readable, ReadableArgs, Writeable, Writer};
32-
use lightning::{impl_writeable_tlv_based, impl_writeable_tlv_based_enum};
32+
use lightning::{impl_ser_tlv_based, impl_ser_tlv_based_enum};
3333
use lightning_liquidity::lsps2::utils::compute_opening_fee;
3434
use lightning_types::payment::{PaymentHash, PaymentPreimage};
3535

@@ -78,7 +78,7 @@ pub struct HTLCLocator {
7878
pub node_id: Option<PublicKey>,
7979
}
8080

81-
impl_writeable_tlv_based!(HTLCLocator, {
81+
impl_ser_tlv_based!(HTLCLocator, {
8282
(1, channel_id, required),
8383
(3, user_channel_id, option),
8484
(5, node_id, option),
@@ -294,7 +294,7 @@ pub enum Event {
294294
},
295295
}
296296

297-
impl_writeable_tlv_based_enum!(Event,
297+
impl_ser_tlv_based_enum!(Event,
298298
(0, PaymentSuccessful) => {
299299
(0, payment_hash, required),
300300
(1, fee_paid_msat, option),
@@ -1725,15 +1725,24 @@ where
17251725

17261726
self.bump_tx_event_handler.handle_event(&bte).await;
17271727
},
1728-
LdkEvent::OnionMessageIntercepted { peer_node_id, message } => {
1729-
if let Some(om_mailbox) = self.om_mailbox.as_ref() {
1730-
om_mailbox.onion_message_intercepted(peer_node_id, message);
1731-
} else {
1728+
LdkEvent::OnionMessageIntercepted { next_hop, message, .. } => match next_hop {
1729+
lightning::blinded_path::message::NextMessageHop::NodeId(peer_node_id) => {
1730+
if let Some(om_mailbox) = self.om_mailbox.as_ref() {
1731+
om_mailbox.onion_message_intercepted(peer_node_id, message);
1732+
} else {
1733+
log_trace!(
1734+
self.logger,
1735+
"Onion message intercepted, but no onion message mailbox available"
1736+
);
1737+
}
1738+
},
1739+
lightning::blinded_path::message::NextMessageHop::ShortChannelId(scid) => {
17321740
log_trace!(
17331741
self.logger,
1734-
"Onion message intercepted, but no onion message mailbox available"
1742+
"Onion message intercepted for unknown SCID {}, ignoring",
1743+
scid
17351744
);
1736-
}
1745+
},
17371746
},
17381747
LdkEvent::OnionMessagePeerConnected { peer_node_id } => {
17391748
if let Some(om_mailbox) = self.om_mailbox.as_ref() {

src/ffi/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1270,7 +1270,7 @@ impl Bolt11Invoice {
12701270
}
12711271

12721272
/// Recover the payee's public key (only to be used if none was included in the invoice)
1273-
pub fn recover_payee_pub_key(&self) -> PublicKey {
1273+
pub fn recover_payee_pub_key(&self) -> Option<PublicKey> {
12741274
self.inner.recover_payee_pub_key()
12751275
}
12761276
}

src/io/vss_store.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use bitcoin::bip32::{ChildNumber, Xpriv};
2121
use bitcoin::hashes::{sha256, Hash, HashEngine, Hmac, HmacEngine};
2222
use bitcoin::key::Secp256k1;
2323
use bitcoin::Network;
24-
use lightning::impl_writeable_tlv_based_enum;
24+
use lightning::impl_ser_tlv_based_enum;
2525
use lightning::io::{self, Error, ErrorKind};
2626
use lightning::sign::{EntropySource as LdkEntropySource, RandomBytes};
2727
use lightning::util::persist::KVStore;
@@ -65,7 +65,7 @@ enum VssSchemaVersion {
6565
V1,
6666
}
6767

68-
impl_writeable_tlv_based_enum!(VssSchemaVersion,
68+
impl_ser_tlv_based_enum!(VssSchemaVersion,
6969
(0, V0) => {},
7070
(1, V1) => {},
7171
);

src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ use graph::NetworkGraph;
146146
use io::utils::update_and_persist_node_metrics;
147147
pub use lightning;
148148
use lightning::chain::BlockLocator;
149-
use lightning::impl_writeable_tlv_based;
149+
use lightning::impl_ser_tlv_based;
150150
use lightning::ln::chan_utils::FUNDING_TRANSACTION_WITNESS_WEIGHT;
151151
use lightning::ln::channel_state::ChannelDetails as LdkChannelDetails;
152152
pub use lightning::ln::channel_state::ChannelShutdownState;
@@ -2268,7 +2268,7 @@ impl PersistedNodeMetrics {
22682268
}
22692269
}
22702270

2271-
impl_writeable_tlv_based!(NodeMetrics, {
2271+
impl_ser_tlv_based!(NodeMetrics, {
22722272
(0, latest_lightning_wallet_sync_timestamp, option),
22732273
(1, latest_pathfinding_scores_sync_timestamp, option),
22742274
(2, latest_onchain_wallet_sync_timestamp, option),
@@ -2338,7 +2338,7 @@ mod tests {
23382338
latest_pathfinding_scores_sync_timestamp: Option<u64>,
23392339
latest_node_announcement_broadcast_timestamp: Option<u64>,
23402340
}
2341-
impl_writeable_tlv_based!(OldNodeMetrics, {
2341+
impl_ser_tlv_based!(OldNodeMetrics, {
23422342
(0, latest_lightning_wallet_sync_timestamp, option),
23432343
(1, latest_pathfinding_scores_sync_timestamp, option),
23442344
(2, latest_onchain_wallet_sync_timestamp, option),

src/payment/asynchronous/static_invoice_store.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use std::time::Duration;
1313
use bitcoin::hashes::sha256::Hash as Sha256;
1414
use bitcoin::hashes::Hash;
1515
use lightning::blinded_path::message::BlindedMessagePath;
16-
use lightning::impl_writeable_tlv_based;
16+
use lightning::impl_ser_tlv_based;
1717
use lightning::offers::static_invoice::StaticInvoice;
1818
use lightning::util::persist::KVStore;
1919
use lightning::util::ser::{Readable, Writeable};
@@ -28,7 +28,7 @@ struct PersistedStaticInvoice {
2828
request_path: BlindedMessagePath,
2929
}
3030

31-
impl_writeable_tlv_based!(PersistedStaticInvoice, {
31+
impl_ser_tlv_based!(PersistedStaticInvoice, {
3232
(0, invoice, required),
3333
(2, request_path, required)
3434
});

src/payment/bolt11.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use std::sync::{Arc, RwLock};
1313

1414
use bitcoin::hashes::sha256::Hash as Sha256;
1515
use bitcoin::hashes::Hash;
16-
use lightning::impl_writeable_tlv_based;
16+
use lightning::impl_ser_tlv_based;
1717
use lightning::ln::channelmanager::{
1818
Bolt11InvoiceParameters, OptionalBolt11PaymentParams, PaymentId,
1919
};
@@ -55,7 +55,7 @@ pub(crate) struct PaymentMetadata {
5555
pub(crate) lsps2_parameters: Option<LSPS2Parameters>,
5656
}
5757

58-
impl_writeable_tlv_based!(PaymentMetadata, {
58+
impl_ser_tlv_based!(PaymentMetadata, {
5959
(0, lsps2_parameters, option),
6060
});
6161

@@ -309,7 +309,7 @@ impl Bolt11Payment {
309309
let payee_pubkey = invoice.recover_payee_pub_key();
310310
let amt_msat =
311311
invoice.amount_milli_satoshis().expect("invoice amount should be set");
312-
log_info!(self.logger, "Initiated sending {}msat to {}", amt_msat, payee_pubkey);
312+
log_info!(self.logger, "Initiated sending {}msat to {:?}", amt_msat, payee_pubkey);
313313

314314
let kind = PaymentKind::Bolt11 {
315315
hash: payment_hash,
@@ -422,7 +422,7 @@ impl Bolt11Payment {
422422
let payee_pubkey = invoice.recover_payee_pub_key();
423423
log_info!(
424424
self.logger,
425-
"Initiated sending {} msat to {}",
425+
"Initiated sending {} msat to {:?}",
426426
amount_msat,
427427
payee_pubkey
428428
);

src/payment/pending_payment_store.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// accordance with one or both of these licenses.
77

88
use bitcoin::Txid;
9-
use lightning::impl_writeable_tlv_based;
9+
use lightning::impl_ser_tlv_based;
1010
use lightning::ln::channelmanager::PaymentId;
1111

1212
use crate::data_store::{StorableObject, StorableObjectUpdate};
@@ -33,7 +33,7 @@ impl PendingPaymentDetails {
3333
}
3434
}
3535

36-
impl_writeable_tlv_based!(PendingPaymentDetails, {
36+
impl_ser_tlv_based!(PendingPaymentDetails, {
3737
(0, details, required),
3838
(2, conflicting_txids, optional_vec),
3939
});

0 commit comments

Comments
 (0)