Skip to content

Commit 12f6e13

Browse files
committed
DROPME: Bump Rust Lightning to unmerged LSPS2 APIs
Point the Rust Lightning dependency overrides at the unmerged LSPS2 PR revisions and carry the temporary API updates needed for LDK Node to compile against them. Co-Authored-By: HAL 9000
1 parent 00dba45 commit 12f6e13

13 files changed

Lines changed: 61 additions & 51 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 = { git = "https://github.com/tnull/rust-lightning", rev = "26da1dde77c27563121245ea5f506093f88b1323" }
188+
lightning-types = { git = "https://github.com/tnull/rust-lightning", rev = "26da1dde77c27563121245ea5f506093f88b1323" }
189+
lightning-invoice = { git = "https://github.com/tnull/rust-lightning", rev = "26da1dde77c27563121245ea5f506093f88b1323" }
190+
lightning-net-tokio = { git = "https://github.com/tnull/rust-lightning", rev = "26da1dde77c27563121245ea5f506093f88b1323" }
191+
lightning-persister = { git = "https://github.com/tnull/rust-lightning", rev = "26da1dde77c27563121245ea5f506093f88b1323" }
192+
lightning-background-processor = { git = "https://github.com/tnull/rust-lightning", rev = "26da1dde77c27563121245ea5f506093f88b1323" }
193+
lightning-rapid-gossip-sync = { git = "https://github.com/tnull/rust-lightning", rev = "26da1dde77c27563121245ea5f506093f88b1323" }
194+
lightning-block-sync = { git = "https://github.com/tnull/rust-lightning", rev = "26da1dde77c27563121245ea5f506093f88b1323" }
195+
lightning-transaction-sync = { git = "https://github.com/tnull/rust-lightning", rev = "26da1dde77c27563121245ea5f506093f88b1323" }
196+
lightning-liquidity = { git = "https://github.com/tnull/rust-lightning", rev = "26da1dde77c27563121245ea5f506093f88b1323" }
197+
lightning-macros = { git = "https://github.com/tnull/rust-lightning", rev = "26da1dde77c27563121245ea5f506093f88b1323" }
198+
lightning-dns-resolver = { git = "https://github.com/tnull/rust-lightning", rev = "26da1dde77c27563121245ea5f506093f88b1323" }

src/builder.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1932,6 +1932,7 @@ fn build_with_store_internal(
19321932
Arc::clone(&channel_manager),
19331933
Arc::clone(&om_resolver),
19341934
IgnoringMessageHandler {},
1935+
false,
19351936
))
19361937
} else {
19371938
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),
@@ -1724,15 +1724,24 @@ where
17241724

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

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
@@ -147,7 +147,7 @@ use graph::NetworkGraph;
147147
use io::utils::update_and_persist_node_metrics;
148148
pub use lightning;
149149
use lightning::chain::BlockLocator;
150-
use lightning::impl_writeable_tlv_based;
150+
use lightning::impl_ser_tlv_based;
151151
use lightning::ln::chan_utils::FUNDING_TRANSACTION_WITNESS_WEIGHT;
152152
use lightning::ln::channel_state::ChannelDetails as LdkChannelDetails;
153153
pub use lightning::ln::channel_state::ChannelShutdownState;
@@ -2223,7 +2223,7 @@ impl PersistedNodeMetrics {
22232223
}
22242224
}
22252225

2226-
impl_writeable_tlv_based!(NodeMetrics, {
2226+
impl_ser_tlv_based!(NodeMetrics, {
22272227
(0, latest_lightning_wallet_sync_timestamp, option),
22282228
(1, latest_pathfinding_scores_sync_timestamp, option),
22292229
(2, latest_onchain_wallet_sync_timestamp, option),
@@ -2293,7 +2293,7 @@ mod tests {
22932293
latest_pathfinding_scores_sync_timestamp: Option<u64>,
22942294
latest_node_announcement_broadcast_timestamp: Option<u64>,
22952295
}
2296-
impl_writeable_tlv_based!(OldNodeMetrics, {
2296+
impl_ser_tlv_based!(OldNodeMetrics, {
22972297
(0, latest_lightning_wallet_sync_timestamp, option),
22982298
(1, latest_pathfinding_scores_sync_timestamp, option),
22992299
(2, latest_onchain_wallet_sync_timestamp, option),

src/liquidity.rs

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

5555
const LSPS2_GETINFO_REQUEST_EXPIRY: Duration = Duration::from_secs(60 * 60 * 24);
56-
const LSPS2_CHANNEL_CLTV_EXPIRY_DELTA: u32 = 72;
56+
const LSPS2_CHANNEL_CLTV_EXPIRY_DELTA: u16 = 72;
5757

5858
struct LSPS1Client {
5959
lsp_node_id: PublicKey,
@@ -1493,7 +1493,7 @@ pub(crate) struct LSPS2FeeResponse {
14931493
#[derive(Debug, Clone)]
14941494
pub(crate) struct LSPS2BuyResponse {
14951495
intercept_scid: u64,
1496-
cltv_expiry_delta: u32,
1496+
cltv_expiry_delta: u16,
14971497
}
14981498

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

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: 2 additions & 2 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

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)