Skip to content

Commit

Permalink
Setter for node_version property (solana-labs#29594)
Browse files Browse the repository at this point in the history
Add: set_node_version method

Co-authored-by: Charles Raimbault <[email protected]>
  • Loading branch information
Tyera and CharlesRA authored Jan 10, 2023
1 parent db277d3 commit 0a6ff82
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pubsub-client/src/nonblocking/pubsub_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,12 @@ impl PubsubClient {
self.ws.await.unwrap() // WS future should not be cancelled or panicked
}

pub async fn set_node_version(&self, version: semver::Version) -> Result<(), ()> {
let mut w_node_version = self.node_version.write().await;
*w_node_version = Some(version);
Ok(())
}

async fn get_node_version(&self) -> PubsubClientResult<semver::Version> {
let r_node_version = self.node_version.read().await;
if let Some(version) = &*r_node_version {
Expand Down
6 changes: 6 additions & 0 deletions rpc-client/src/nonblocking/rpc_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,12 @@ impl RpcClient {
self.sender.url()
}

pub async fn set_node_version(&self, version: semver::Version) -> Result<(), ()> {
let mut w_node_version = self.node_version.write().await;
*w_node_version = Some(version);
Ok(())
}

async fn get_node_version(&self) -> Result<semver::Version, RpcError> {
let r_node_version = self.node_version.read().await;
if let Some(version) = &*r_node_version {
Expand Down

0 comments on commit 0a6ff82

Please sign in to comment.