Add backwards compatibility support to get_highest_snapshot_slot() (#19591)

Co-authored-by: Michael Vines <mvines@gmail.com>
This commit is contained in:
Brooks Prumo 2021-09-02 20:47:35 -05:00 committed by GitHub
parent 3936c10aa0
commit 38e1f7c4ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 1 deletions

View File

@ -1041,7 +1041,15 @@ impl RpcClient {
/// # Ok::<(), ClientError>(())
/// ```
pub fn get_highest_snapshot_slot(&self) -> ClientResult<RpcSnapshotSlotInfo> {
self.send(RpcRequest::GetHighestSnapshotSlot, Value::Null)
if self.get_node_version()? < semver::Version::new(1, 8, 0) {
#[allow(deprecated)]
self.get_snapshot_slot().map(|full| RpcSnapshotSlotInfo {
full,
incremental: None,
})
} else {
self.send(RpcRequest::GetHighestSnapshotSlot, Value::Null)
}
}
#[deprecated(