Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Commit 84b6120

Browse files
authored
getClusterNodes RPC API now includes the node software version (#9990)
1 parent 3b9dc50 commit 84b6120

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

client/src/rpc_response.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ pub struct RpcContactInfo {
108108
pub tpu: Option<SocketAddr>,
109109
/// JSON RPC port
110110
pub rpc: Option<SocketAddr>,
111+
/// Software version
112+
pub version: Option<String>,
111113
}
112114

113115
/// Map of leader base58 identity pubkeys to the slot indices relative to the first epoch slot

core/src/rpc.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1063,6 +1063,9 @@ impl RpcSol for RpcSolImpl {
10631063
gossip: Some(contact_info.gossip),
10641064
tpu: valid_address_or_none(&contact_info.tpu),
10651065
rpc: valid_address_or_none(&contact_info.rpc),
1066+
version: cluster_info
1067+
.get_node_version(&contact_info.id)
1068+
.map(|v| v.to_string()),
10661069
})
10671070
} else {
10681071
None // Exclude spy nodes
@@ -1828,7 +1831,7 @@ pub mod tests {
18281831
.expect("actual response deserialization");
18291832

18301833
let expected = format!(
1831-
r#"{{"jsonrpc":"2.0","result":[{{"pubkey": "{}", "gossip": "127.0.0.1:1235", "tpu": "127.0.0.1:1234", "rpc": "127.0.0.1:{}"}}],"id":1}}"#,
1834+
r#"{{"jsonrpc":"2.0","result":[{{"pubkey": "{}", "gossip": "127.0.0.1:1235", "tpu": "127.0.0.1:1234", "rpc": "127.0.0.1:{}", "version": null}}],"id":1}}"#,
18321835
leader_pubkey,
18331836
rpc_port::DEFAULT_RPC_PORT
18341837
);

docs/src/apps/jsonrpc-api.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,8 @@ The result field will be an array of JSON objects, each with the following sub f
259259
* `pubkey: <string>` - Node public key, as base-58 encoded string
260260
* `gossip: <string>` - Gossip network address for the node
261261
* `tpu: <string>` - TPU network address for the node
262-
* `rpc: <string>` - JSON RPC network address for the node, or `null` if the JSON RPC service is not enabled
262+
* `rpc: <string>|null` - JSON RPC network address for the node, or `null` if the JSON RPC service is not enabled
263+
* `version: <string>|null` - The software version of the node, or `null` if the version information is not available
263264

264265
#### Example:
265266

@@ -268,7 +269,7 @@ The result field will be an array of JSON objects, each with the following sub f
268269
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0", "id":1, "method":"getClusterNodes"}' http://localhost:8899
269270

270271
// Result
271-
{"jsonrpc":"2.0","result":[{"gossip":"10.239.6.48:8001","pubkey":"9QzsJf7LPLj8GkXbYT3LFDKqsj2hHG7TA3xinJHu8epQ","rpc":"10.239.6.48:8899","tpu":"10.239.6.48:8856"}],"id":1}
272+
{"jsonrpc":"2.0","result":[{"gossip":"10.239.6.48:8001","pubkey":"9QzsJf7LPLj8GkXbYT3LFDKqsj2hHG7TA3xinJHu8epQ","rpc":"10.239.6.48:8899","tpu":"10.239.6.48:8856"},"version":"1.0.0 c375ce1f"],"id":1}
272273
```
273274

274275
### getConfirmedBlock

0 commit comments

Comments
 (0)