Skip to content

Commit 928d92a

Browse files
committed
Add network field to GetNodeInfoResponse
Expose the Bitcoin network the node is running on (e.g., "bitcoin", "testnet", "signet", "regtest") via the get-node-info API.
1 parent 50fe752 commit 928d92a

5 files changed

Lines changed: 25 additions & 16 deletions

File tree

‎Cargo.lock‎

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎ldk-server-grpc/src/api.rs‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ pub struct GetNodeInfoResponse {
7979
/// Will be empty if no announcement addresses are configured.
8080
#[prost(string, repeated, tag = "12")]
8181
pub node_uris: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
82+
/// The Bitcoin network the node is running on (e.g., "bitcoin", "testnet", "signet", "regtest").
83+
#[prost(string, tag = "13")]
84+
pub network: ::prost::alloc::string::String,
8285
}
8386
/// Retrieve a new on-chain funding address.
8487
/// See more: <https://docs.rs/ldk-node/latest/ldk_node/payment/struct.OnchainPayment.html#method.new_address>

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ message GetNodeInfoResponse {
7070
// These are constructed from the announcement addresses and the node's public key.
7171
// Will be empty if no announcement addresses are configured.
7272
repeated string node_uris = 12;
73+
74+
// The Bitcoin network the node is running on (e.g., "bitcoin", "testnet", "signet", "regtest").
75+
string network = 13;
7376
}
7477

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

‎ldk-server/Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version = "0.1.0"
44
edition = "2021"
55

66
[dependencies]
7-
ldk-node = { git = "https://github.com/lightningdevkit/ldk-node", rev = "21eea8c881790db7a90bcad4f7f45f341c72222b" }
7+
ldk-node = { git = "https://github.com/lightningdevkit/ldk-node", rev = "16eaa6f46308965f501904506be3ceecd293f358" }
88
serde = { version = "1.0.203", default-features = false, features = ["derive"] }
99
hyper = { version = "1", default-features = false, features = ["server", "http2"] }
1010
http-body-util = { version = "0.1", default-features = false }

‎ldk-server/src/api/get_node_info.rs‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ pub(crate) async fn handle_get_node_info_request(
4949
};
5050
addrs.into_iter().map(|a| format!("{node_id}@{a}")).collect()
5151
};
52+
let network = node_status.network.to_string();
53+
5254
let response = GetNodeInfoResponse {
5355
node_id,
5456
current_best_block: Some(best_block),
@@ -62,6 +64,7 @@ pub(crate) async fn handle_get_node_info_request(
6264
announcement_addresses,
6365
node_alias,
6466
node_uris,
67+
network,
6568
};
6669
Ok(response)
6770
}

0 commit comments

Comments
 (0)