diff --git a/client/src/rpc_response.rs b/client/src/rpc_response.rs index 9a328e0c1b..d339b95fe0 100644 --- a/client/src/rpc_response.rs +++ b/client/src/rpc_response.rs @@ -108,6 +108,8 @@ pub struct RpcContactInfo { pub tpu: Option, /// JSON RPC port pub rpc: Option, + /// Software version + pub version: Option, } /// Map of leader base58 identity pubkeys to the slot indices relative to the first epoch slot diff --git a/core/src/rpc.rs b/core/src/rpc.rs index 495d82b431..83e8fcfd8c 100644 --- a/core/src/rpc.rs +++ b/core/src/rpc.rs @@ -1063,6 +1063,9 @@ impl RpcSol for RpcSolImpl { gossip: Some(contact_info.gossip), tpu: valid_address_or_none(&contact_info.tpu), rpc: valid_address_or_none(&contact_info.rpc), + version: cluster_info + .get_node_version(&contact_info.id) + .map(|v| v.to_string()), }) } else { None // Exclude spy nodes @@ -1828,7 +1831,7 @@ pub mod tests { .expect("actual response deserialization"); let expected = format!( - 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}}"#, + 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}}"#, leader_pubkey, rpc_port::DEFAULT_RPC_PORT ); diff --git a/docs/src/apps/jsonrpc-api.md b/docs/src/apps/jsonrpc-api.md index 9b731abc28..a35874c278 100644 --- a/docs/src/apps/jsonrpc-api.md +++ b/docs/src/apps/jsonrpc-api.md @@ -259,7 +259,8 @@ The result field will be an array of JSON objects, each with the following sub f * `pubkey: ` - Node public key, as base-58 encoded string * `gossip: ` - Gossip network address for the node * `tpu: ` - TPU network address for the node -* `rpc: ` - JSON RPC network address for the node, or `null` if the JSON RPC service is not enabled +* `rpc: |null` - JSON RPC network address for the node, or `null` if the JSON RPC service is not enabled +* `version: |null` - The software version of the node, or `null` if the version information is not available #### Example: @@ -268,7 +269,7 @@ The result field will be an array of JSON objects, each with the following sub f curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0", "id":1, "method":"getClusterNodes"}' http://localhost:8899 // Result -{"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} +{"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} ``` ### getConfirmedBlock