rpc: add getSlotLeaders method (#16057) (#16079)

(cherry picked from commit e7fd7d46cf)

Co-authored-by: Justin Starry <justin@solana.com>
This commit is contained in:
mergify[bot]
2021-03-23 19:27:18 +00:00
committed by GitHub
parent 9d37a33dcd
commit c3c4991c44
8 changed files with 239 additions and 28 deletions

View File

@@ -18,7 +18,7 @@ use jsonrpc_http_server::{
};
use regex::Regex;
use solana_client::rpc_cache::LargestAccountsCache;
use solana_ledger::blockstore::Blockstore;
use solana_ledger::{blockstore::Blockstore, leader_schedule_cache::LeaderScheduleCache};
use solana_metrics::inc_new_counter_info;
use solana_runtime::{
bank_forks::{BankForks, SnapshotConfig},
@@ -275,6 +275,7 @@ impl JsonRpcService {
send_transaction_retry_ms: u64,
send_transaction_leader_forward_count: u64,
max_slots: Arc<MaxSlots>,
leader_schedule_cache: Arc<LeaderScheduleCache>,
) -> Self {
info!("rpc bound to {:?}", rpc_addr);
info!("rpc configuration: {:?}", config);
@@ -354,6 +355,7 @@ impl JsonRpcService {
optimistically_confirmed_bank,
largest_accounts_cache,
max_slots,
leader_schedule_cache,
);
let leader_info =
@@ -518,6 +520,7 @@ mod tests {
1000,
1,
Arc::new(MaxSlots::default()),
Arc::new(LeaderScheduleCache::default()),
);
let thread = rpc_service.thread_hdl.thread();
assert_eq!(thread.name().unwrap(), "solana-jsonrpc");