Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions e2e-tests/tests/e2e.rs
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,8 @@ async fn test_subscribe_events_channel_state_lifecycle_pending_ready_closed() {
assert!(pending_a.funding_txo.is_some());
assert!(pending_a.reason.is_none());
assert_eq!(pending_a.closure_initiator, ChannelClosureInitiator::Unspecified as i32);
assert!(pending_a.former_temporary_channel_id.as_deref().is_some_and(|id| !id.is_empty()));
Comment thread
elnafateh marked this conversation as resolved.
assert_ne!(pending_a.former_temporary_channel_id.as_deref(), Some(pending_a.channel_id.as_str()));

let pending_b = wait_for_event(&mut events_b, |e| {
matches!(
Expand Down Expand Up @@ -676,6 +678,8 @@ async fn test_subscribe_events_channel_state_lifecycle_pending_ready_force_close
assert!(pending_a.funding_txo.is_some());
assert!(pending_a.reason.is_none());
assert_eq!(pending_a.closure_initiator, ChannelClosureInitiator::Unspecified as i32);
assert!(pending_a.former_temporary_channel_id.as_deref().is_some_and(|id| !id.is_empty()));
Comment thread
elnafateh marked this conversation as resolved.
assert_ne!(pending_a.former_temporary_channel_id.as_deref(), Some(pending_a.channel_id.as_str()));

let pending_b = wait_for_event(&mut events_b, |e| {
matches!(
Expand Down
7 changes: 7 additions & 0 deletions ldk-server-grpc/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,13 @@ pub struct GetNodeInfoResponse {
/// Features advertised by this node, keyed by the signaled BOLT feature bit.
#[prost(btree_map = "uint32, message", tag = "14")]
pub features: ::prost::alloc::collections::BTreeMap<u32, super::types::Feature>,
/// The timestamp, in seconds since start of the UNIX epoch, when we last successfully merged
/// external pathfinding scores.
///
/// Will be `None` if background pathfinding score syncing isn't configured, or no scores have
/// been merged since the node was initialized.
#[prost(uint64, optional, tag = "15")]
pub latest_pathfinding_scores_sync_timestamp: ::core::option::Option<u64>,
}
/// Retrieve a new on-chain funding address.
/// See more: <https://docs.rs/ldk-node/latest/ldk_node/payment/struct.OnchainPayment.html#method.new_address>
Expand Down
5 changes: 5 additions & 0 deletions ldk-server-grpc/src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@ pub struct ChannelStateChanged {
pub reason: ::core::option::Option<ChannelStateChangeReason>,
#[prost(enumeration = "ChannelClosureInitiator", tag = "7")]
pub closure_initiator: i32,
/// The `temporary_channel_id` this channel used to be known by during channel establishment.
///
/// Only set when `state` is `CHANNEL_STATE_PENDING`.
#[prost(string, optional, tag = "8")]
pub former_temporary_channel_id: ::core::option::Option<::prost::alloc::string::String>,
}
/// SpliceNegotiated indicates a channel splice has been negotiated and the funding
/// transaction is pending confirmation on-chain.
Expand Down
7 changes: 7 additions & 0 deletions ldk-server-grpc/src/proto/api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ message GetNodeInfoResponse {

// Features advertised by this node, keyed by the signaled BOLT feature bit.
map<uint32, types.Feature> features = 14;

// The timestamp, in seconds since start of the UNIX epoch, when we last successfully merged
// external pathfinding scores.
//
// Will be `None` if background pathfinding score syncing isn't configured, or no scores have
// been merged since the node was initialized.
optional uint64 latest_pathfinding_scores_sync_timestamp = 15;
}

// Retrieve a new on-chain funding address.
Expand Down
4 changes: 4 additions & 0 deletions ldk-server-grpc/src/proto/events.proto
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ message ChannelStateChanged {
optional string funding_txo = 5;
optional ChannelStateChangeReason reason = 6;
ChannelClosureInitiator closure_initiator = 7;
// The `temporary_channel_id` this channel used to be known by during channel establishment.
//
// Only set when `state` is `CHANNEL_STATE_PENDING`.
optional string former_temporary_channel_id = 8;
}

// SpliceNegotiated indicates a channel splice has been negotiated and the funding
Expand Down
2 changes: 2 additions & 0 deletions ldk-server/src/api/get_node_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ pub(crate) async fn handle_get_node_info_request(
node_uris,
network,
features,
latest_pathfinding_scores_sync_timestamp: node_status
.latest_pathfinding_scores_sync_timestamp,
};
Ok(response)
}
7 changes: 6 additions & 1 deletion ldk-server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ fn main() {
user_channel_id,
counterparty_node_id,
funding_txo,
..
former_temporary_channel_id,
} => {
info!(
"CHANNEL_PENDING: {} from counterparty {}",
Expand All @@ -398,6 +398,9 @@ fn main() {
funding_txo: Some(funding_txo.to_string()),
reason: None,
closure_initiator: events::ChannelClosureInitiator::Unspecified.into(),
former_temporary_channel_id: Some(
former_temporary_channel_id.0.to_lower_hex_string(),
),
}),
&event_sender,
);
Expand Down Expand Up @@ -430,6 +433,7 @@ fn main() {
funding_txo: funding_txo.map(|outpoint| outpoint.to_string()),
reason: None,
closure_initiator: events::ChannelClosureInitiator::Unspecified.into(),
former_temporary_channel_id: None,
}),
&event_sender,
);
Expand Down Expand Up @@ -471,6 +475,7 @@ fn main() {
funding_txo: None,
reason: reason_ref.map(closure_reason_to_proto),
closure_initiator: closure_initiator_from_reason(reason_ref).into(),
former_temporary_channel_id: None,
}),
&event_sender,
);
Expand Down