Move BankCommitmentCache to solana_runtime (#10816)

* Remove Blockstore member variable from BlockCommitmentCache

* Hoist is_confirmed_rooted() to its only caller

BlockCommitmentCache no longer depends on Blockstore

* Move BlockCommitmentCache to solana_runtime
This commit is contained in:
Greg Fitzgerald
2020-06-25 22:06:58 -06:00
committed by GitHub
parent 7430978d1a
commit 50b3fa83a0
16 changed files with 165 additions and 340 deletions

View File

@@ -1,7 +1,7 @@
//! The `rpc_service` module implements the Solana JSON RPC service.
use crate::{
cluster_info::ClusterInfo, commitment::BlockCommitmentCache, rpc::*, rpc_health::*,
cluster_info::ClusterInfo, rpc::*, rpc_health::*,
send_transaction_service::SendTransactionService, validator::ValidatorExit,
};
use jsonrpc_core::MetaIoHandler;
@@ -13,6 +13,7 @@ use regex::Regex;
use solana_ledger::blockstore::Blockstore;
use solana_runtime::{
bank_forks::{BankForks, SnapshotConfig},
commitment::BlockCommitmentCache,
snapshot_utils,
};
use solana_sdk::{hash::Hash, native_token::lamports_to_sol, pubkey::Pubkey};
@@ -378,9 +379,7 @@ mod tests {
let bank_forks = Arc::new(RwLock::new(BankForks::new(bank)));
let ledger_path = get_tmp_ledger_path!();
let blockstore = Arc::new(Blockstore::open(&ledger_path).unwrap());
let block_commitment_cache = Arc::new(RwLock::new(
BlockCommitmentCache::default_with_blockstore(blockstore.clone()),
));
let block_commitment_cache = Arc::new(RwLock::new(BlockCommitmentCache::default()));
let mut rpc_service = JsonRpcService::new(
rpc_addr,
JsonRpcConfig::default(),