Skip to content

Commit af07db4

Browse files
committed
fix tag-ordering and add two assert_ne! checks
1 parent 4010a2f commit af07db4

7 files changed

Lines changed: 35 additions & 1 deletion

File tree

e2e-tests/tests/e2e.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,8 @@ async fn test_subscribe_events_channel_state_lifecycle_pending_ready_closed() {
510510
assert!(pending_a.funding_txo.is_some());
511511
assert!(pending_a.reason.is_none());
512512
assert_eq!(pending_a.closure_initiator, ChannelClosureInitiator::Unspecified as i32);
513+
assert!(pending_a.former_temporary_channel_id.as_deref().is_some_and(|id| !id.is_empty()));
514+
assert_ne!(pending_a.former_temporary_channel_id.as_deref(), Some(pending_a.channel_id.as_str()));
513515

514516
let pending_b = wait_for_event(&mut events_b, |e| {
515517
matches!(
@@ -676,6 +678,8 @@ async fn test_subscribe_events_channel_state_lifecycle_pending_ready_force_close
676678
assert!(pending_a.funding_txo.is_some());
677679
assert!(pending_a.reason.is_none());
678680
assert_eq!(pending_a.closure_initiator, ChannelClosureInitiator::Unspecified as i32);
681+
assert!(pending_a.former_temporary_channel_id.as_deref().is_some_and(|id| !id.is_empty()));
682+
assert_ne!(pending_a.former_temporary_channel_id.as_deref(), Some(pending_a.channel_id.as_str()));
679683

680684
let pending_b = wait_for_event(&mut events_b, |e| {
681685
matches!(

ldk-server-grpc/src/api.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,13 @@ pub struct GetNodeInfoResponse {
8888
/// Features advertised by this node, keyed by the signaled BOLT feature bit.
8989
#[prost(btree_map = "uint32, message", tag = "14")]
9090
pub features: ::prost::alloc::collections::BTreeMap<u32, super::types::Feature>,
91+
/// The timestamp, in seconds since start of the UNIX epoch, when we last successfully merged
92+
/// external pathfinding scores.
93+
///
94+
/// Will be `None` if background pathfinding score syncing isn't configured, or no scores have
95+
/// been merged since the node was initialized.
96+
#[prost(uint64, optional, tag = "15")]
97+
pub latest_pathfinding_scores_sync_timestamp: ::core::option::Option<u64>,
9198
}
9299
/// Retrieve a new on-chain funding address.
93100
/// See more: <https://docs.rs/ldk-node/latest/ldk_node/payment/struct.OnchainPayment.html#method.new_address>

ldk-server-grpc/src/events.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,11 @@ pub struct ChannelStateChanged {
143143
pub reason: ::core::option::Option<ChannelStateChangeReason>,
144144
#[prost(enumeration = "ChannelClosureInitiator", tag = "7")]
145145
pub closure_initiator: i32,
146+
/// The `temporary_channel_id` this channel used to be known by during channel establishment.
147+
///
148+
/// Only set when `state` is `CHANNEL_STATE_PENDING`.
149+
#[prost(string, optional, tag = "8")]
150+
pub former_temporary_channel_id: ::core::option::Option<::prost::alloc::string::String>,
146151
}
147152
/// SpliceNegotiated indicates a channel splice has been negotiated and the funding
148153
/// transaction is pending confirmation on-chain.

ldk-server-grpc/src/proto/api.proto

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,13 @@ message GetNodeInfoResponse {
7676

7777
// Features advertised by this node, keyed by the signaled BOLT feature bit.
7878
map<uint32, types.Feature> features = 14;
79+
80+
// The timestamp, in seconds since start of the UNIX epoch, when we last successfully merged
81+
// external pathfinding scores.
82+
//
83+
// Will be `None` if background pathfinding score syncing isn't configured, or no scores have
84+
// been merged since the node was initialized.
85+
optional uint64 latest_pathfinding_scores_sync_timestamp = 15;
7986
}
8087

8188
// Retrieve a new on-chain funding address.

ldk-server-grpc/src/proto/events.proto

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@ message ChannelStateChanged {
120120
optional string funding_txo = 5;
121121
optional ChannelStateChangeReason reason = 6;
122122
ChannelClosureInitiator closure_initiator = 7;
123+
// The `temporary_channel_id` this channel used to be known by during channel establishment.
124+
//
125+
// Only set when `state` is `CHANNEL_STATE_PENDING`.
126+
optional string former_temporary_channel_id = 8;
123127
}
124128

125129
// SpliceNegotiated indicates a channel splice has been negotiated and the funding

ldk-server/src/api/get_node_info.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ pub(crate) async fn handle_get_node_info_request(
7272
node_uris,
7373
network,
7474
features,
75+
latest_pathfinding_scores_sync_timestamp: node_status
76+
.latest_pathfinding_scores_sync_timestamp,
7577
};
7678
Ok(response)
7779
}

ldk-server/src/main.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ fn main() {
382382
user_channel_id,
383383
counterparty_node_id,
384384
funding_txo,
385-
..
385+
former_temporary_channel_id,
386386
} => {
387387
info!(
388388
"CHANNEL_PENDING: {} from counterparty {}",
@@ -398,6 +398,9 @@ fn main() {
398398
funding_txo: Some(funding_txo.to_string()),
399399
reason: None,
400400
closure_initiator: events::ChannelClosureInitiator::Unspecified.into(),
401+
former_temporary_channel_id: Some(
402+
former_temporary_channel_id.0.to_lower_hex_string(),
403+
),
401404
}),
402405
&event_sender,
403406
);
@@ -430,6 +433,7 @@ fn main() {
430433
funding_txo: funding_txo.map(|outpoint| outpoint.to_string()),
431434
reason: None,
432435
closure_initiator: events::ChannelClosureInitiator::Unspecified.into(),
436+
former_temporary_channel_id: None,
433437
}),
434438
&event_sender,
435439
);
@@ -471,6 +475,7 @@ fn main() {
471475
funding_txo: None,
472476
reason: reason_ref.map(closure_reason_to_proto),
473477
closure_initiator: closure_initiator_from_reason(reason_ref).into(),
478+
former_temporary_channel_id: None,
474479
}),
475480
&event_sender,
476481
);

0 commit comments

Comments
 (0)