Speed up getLeaderSchedule RPC call by reducing pubkey duplication

This commit is contained in:
Michael Vines
2019-12-18 12:42:58 -07:00
parent 6a9005645a
commit bd22b641b3
4 changed files with 36 additions and 18 deletions

View File

@ -6,7 +6,7 @@ use solana_sdk::{
hash::Hash,
transaction::{Result, Transaction},
};
use std::{error, fmt, io, net::SocketAddr};
use std::{collections::HashMap, error, fmt, io, net::SocketAddr};
pub type RpcResponseIn<T> = JsonResult<Response<T>>;
pub type RpcResponse<T> = io::Result<Response<T>>;
@ -52,6 +52,9 @@ pub struct RpcContactInfo {
pub rpc: Option<SocketAddr>,
}
/// Map of leader base58 identity pubkeys to the slot indices relative to the first epoch slot
pub type RpcLeaderSchedule = HashMap<String, Vec<usize>>;
#[derive(Serialize, Deserialize, Clone, Debug)]
#[serde(rename_all = "camelCase")]
pub struct RpcEpochInfo {