PohRecorder take Arc not &Arc for blockstore (#31234)

This commit is contained in:
Andrew Fitzgerald 2023-04-19 11:41:18 -07:00 committed by GitHub
parent c37b82e01d
commit 10d637d2e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 50 additions and 50 deletions

View File

@ -417,7 +417,7 @@ fn main() {
);
let leader_schedule_cache = Arc::new(LeaderScheduleCache::new_from_bank(&bank));
let (exit, poh_recorder, poh_service, signal_receiver) =
create_test_recorder(&bank, &blockstore, None, Some(leader_schedule_cache));
create_test_recorder(&bank, blockstore.clone(), None, Some(leader_schedule_cache));
let (banking_tracer, tracer_thread) =
BankingTracer::new(matches.is_present("trace_banking").then_some((
&blockstore.banking_trace_path(),

View File

@ -81,7 +81,7 @@ fn bench_consume_buffered(bencher: &mut Bencher) {
Blockstore::open(&ledger_path).expect("Expected to be able to open database ledger"),
);
let (exit, poh_recorder, poh_service, _signal_receiver) =
create_test_recorder(&bank, &blockstore, None, None);
create_test_recorder(&bank, blockstore, None, None);
let recorder = poh_recorder.read().unwrap().new_recorder();
let bank_start = poh_recorder.read().unwrap().bank_start().unwrap();
@ -271,7 +271,7 @@ fn bench_banking(bencher: &mut Bencher, tx_type: TransactionType) {
Blockstore::open(&ledger_path).expect("Expected to be able to open database ledger"),
);
let (exit, poh_recorder, poh_service, signal_receiver) =
create_test_recorder(&bank, &blockstore, None, None);
create_test_recorder(&bank, blockstore, None, None);
let cluster_info = {
let keypair = Arc::new(Keypair::new());
let node = Node::new_localhost_with_pubkey(&keypair.pubkey());

View File

@ -634,7 +634,7 @@ mod tests {
.expect("Expected to be able to open database ledger"),
);
let (exit, poh_recorder, poh_service, _entry_receiever) =
create_test_recorder(&bank, &blockstore, None, None);
create_test_recorder(&bank, blockstore, None, None);
let (_, cluster_info) = new_test_cluster_info(/*keypair:*/ None);
let cluster_info = Arc::new(cluster_info);
let (replay_vote_sender, _replay_vote_receiver) = unbounded();
@ -690,7 +690,7 @@ mod tests {
..PohConfig::default()
};
let (exit, poh_recorder, poh_service, entry_receiver) =
create_test_recorder(&bank, &blockstore, Some(poh_config), None);
create_test_recorder(&bank, blockstore, Some(poh_config), None);
let (_, cluster_info) = new_test_cluster_info(/*keypair:*/ None);
let cluster_info = Arc::new(cluster_info);
let (replay_vote_sender, _replay_vote_receiver) = unbounded();
@ -771,7 +771,7 @@ mod tests {
..PohConfig::default()
};
let (exit, poh_recorder, poh_service, entry_receiver) =
create_test_recorder(&bank, &blockstore, Some(poh_config), None);
create_test_recorder(&bank, blockstore, Some(poh_config), None);
let (_, cluster_info) = new_test_cluster_info(/*keypair:*/ None);
let cluster_info = Arc::new(cluster_info);
let (replay_vote_sender, _replay_vote_receiver) = unbounded();
@ -934,7 +934,7 @@ mod tests {
..PohConfig::default()
};
let (exit, poh_recorder, poh_service, entry_receiver) =
create_test_recorder(&bank, &blockstore, Some(poh_config), None);
create_test_recorder(&bank, blockstore, Some(poh_config), None);
let (_, cluster_info) = new_test_cluster_info(/*keypair:*/ None);
let cluster_info = Arc::new(cluster_info);
let _banking_stage = BankingStage::new_num_threads(
@ -1008,7 +1008,7 @@ mod tests {
None,
bank.ticks_per_slot(),
&Pubkey::default(),
&Arc::new(blockstore),
Arc::new(blockstore),
&Arc::new(LeaderScheduleCache::new_from_bank(&bank)),
&PohConfig::default(),
Arc::new(AtomicBool::default()),
@ -1127,7 +1127,7 @@ mod tests {
..PohConfig::default()
};
let (exit, poh_recorder, poh_service, _entry_receiver) =
create_test_recorder(&bank, &blockstore, Some(poh_config), None);
create_test_recorder(&bank, blockstore, Some(poh_config), None);
let (_, cluster_info) = new_test_cluster_info(/*keypair:*/ None);
let cluster_info = Arc::new(cluster_info);
let (replay_vote_sender, _replay_vote_receiver) = unbounded();

View File

@ -739,7 +739,7 @@ mod tests {
Some((4, 4)),
bank.ticks_per_slot(),
&Pubkey::new_unique(),
&Arc::new(blockstore),
Arc::new(blockstore),
&Arc::new(LeaderScheduleCache::new_from_bank(&bank)),
&PohConfig::default(),
Arc::new(AtomicBool::default()),
@ -828,7 +828,7 @@ mod tests {
Some((4, 4)),
bank.ticks_per_slot(),
&solana_sdk::pubkey::new_rand(),
&Arc::new(blockstore),
Arc::new(blockstore),
&Arc::new(LeaderScheduleCache::new_from_bank(&bank)),
&PohConfig::default(),
exit,
@ -884,7 +884,7 @@ mod tests {
Some((4, 4)),
bank.ticks_per_slot(),
&pubkey,
&Arc::new(blockstore),
Arc::new(blockstore),
&Arc::new(LeaderScheduleCache::new_from_bank(&bank)),
&PohConfig::default(),
Arc::new(AtomicBool::default()),
@ -1011,7 +1011,7 @@ mod tests {
Some((4, 4)),
bank.ticks_per_slot(),
&pubkey,
&Arc::new(blockstore),
Arc::new(blockstore),
&Arc::new(LeaderScheduleCache::new_from_bank(&bank)),
&PohConfig::default(),
Arc::new(AtomicBool::default()),
@ -1083,7 +1083,7 @@ mod tests {
Some((4, 4)),
bank.ticks_per_slot(),
&pubkey,
&Arc::new(blockstore),
Arc::new(blockstore),
&Arc::new(LeaderScheduleCache::new_from_bank(&bank)),
&PohConfig::default(),
Arc::new(AtomicBool::default()),
@ -1204,7 +1204,7 @@ mod tests {
Some((4, 4)),
bank.ticks_per_slot(),
&pubkey,
&Arc::new(blockstore),
Arc::new(blockstore),
&Arc::new(LeaderScheduleCache::new_from_bank(&bank)),
&PohConfig::default(),
Arc::new(AtomicBool::default()),
@ -1401,7 +1401,7 @@ mod tests {
Some((4, 4)),
bank.ticks_per_slot(),
&solana_sdk::pubkey::new_rand(),
&Arc::new(blockstore),
Arc::new(blockstore),
&Arc::new(LeaderScheduleCache::new_from_bank(&bank)),
&PohConfig::default(),
Arc::new(AtomicBool::default()),
@ -1502,7 +1502,7 @@ mod tests {
Some((4, 4)),
bank.ticks_per_slot(),
&pubkey,
&blockstore,
blockstore.clone(),
&Arc::new(LeaderScheduleCache::new_from_bank(&bank)),
&PohConfig::default(),
Arc::new(AtomicBool::default()),
@ -1640,7 +1640,7 @@ mod tests {
Some((4, 4)),
bank.ticks_per_slot(),
&Pubkey::new_unique(),
&blockstore,
blockstore.clone(),
&Arc::new(LeaderScheduleCache::new_from_bank(&bank)),
&PohConfig::default(),
Arc::new(AtomicBool::default()),

View File

@ -318,7 +318,7 @@ mod tests {
};
let (exit, poh_recorder, poh_service, _entry_receiver) =
create_test_recorder(&bank, &blockstore, Some(poh_config), None);
create_test_recorder(&bank, blockstore, Some(poh_config), None);
let (local_node, cluster_info) = new_test_cluster_info(Some(validator_keypair));
let cluster_info = Arc::new(cluster_info);

View File

@ -3834,7 +3834,7 @@ pub(crate) mod tests {
None,
working_bank.ticks_per_slot(),
&Pubkey::default(),
&blockstore,
blockstore.clone(),
&leader_schedule_cache,
&PohConfig::default(),
Arc::new(AtomicBool::new(false)),

View File

@ -413,7 +413,7 @@ pub mod tests {
let blockstore = Arc::new(blockstore);
let bank = bank_forks.working_bank();
let (exit, poh_recorder, poh_service, _entry_receiver) =
create_test_recorder(&bank, &blockstore, None, None);
create_test_recorder(&bank, blockstore.clone(), None, None);
let vote_keypair = Keypair::new();
let leader_schedule_cache = Arc::new(LeaderScheduleCache::new_from_bank(&bank));
let block_commitment_cache = Arc::new(RwLock::new(BlockCommitmentCache::default()));

View File

@ -835,7 +835,7 @@ impl Validator {
None,
bank.ticks_per_slot(),
&id,
&blockstore,
blockstore.clone(),
blockstore.get_new_shred_signal(0),
&leader_schedule_cache,
&genesis_config.poh_config,

View File

@ -909,7 +909,7 @@ impl PohRecorder {
next_leader_slot: Option<(Slot, Slot)>,
ticks_per_slot: u64,
id: &Pubkey,
blockstore: &Arc<Blockstore>,
blockstore: Arc<Blockstore>,
clear_bank_signal: Option<Sender<bool>>,
leader_schedule_cache: &Arc<LeaderScheduleCache>,
poh_config: &PohConfig,
@ -946,7 +946,7 @@ impl PohRecorder {
leader_last_tick_height,
grace_ticks,
id: *id,
blockstore: blockstore.clone(),
blockstore,
leader_schedule_cache: leader_schedule_cache.clone(),
ticks_per_slot,
target_ns_per_tick,
@ -980,7 +980,7 @@ impl PohRecorder {
next_leader_slot: Option<(Slot, Slot)>,
ticks_per_slot: u64,
id: &Pubkey,
blockstore: &Arc<Blockstore>,
blockstore: Arc<Blockstore>,
leader_schedule_cache: &Arc<LeaderScheduleCache>,
poh_config: &PohConfig,
is_exited: Arc<AtomicBool>,
@ -1030,7 +1030,7 @@ impl PohRecorder {
pub fn create_test_recorder(
bank: &Arc<Bank>,
blockstore: &Arc<Blockstore>,
blockstore: Arc<Blockstore>,
poh_config: Option<PohConfig>,
leader_schedule_cache: Option<Arc<LeaderScheduleCache>>,
) -> (
@ -1101,7 +1101,7 @@ mod tests {
Some((4, 4)),
DEFAULT_TICKS_PER_SLOT,
&Pubkey::default(),
&Arc::new(blockstore),
Arc::new(blockstore),
&Arc::new(LeaderScheduleCache::default()),
&PohConfig::default(),
Arc::new(AtomicBool::default()),
@ -1131,7 +1131,7 @@ mod tests {
Some((4, 4)),
DEFAULT_TICKS_PER_SLOT,
&Pubkey::default(),
&Arc::new(blockstore),
Arc::new(blockstore),
&Arc::new(LeaderScheduleCache::default()),
&PohConfig::default(),
Arc::new(AtomicBool::default()),
@ -1160,7 +1160,7 @@ mod tests {
Some((4, 4)),
DEFAULT_TICKS_PER_SLOT,
&Pubkey::default(),
&Arc::new(blockstore),
Arc::new(blockstore),
&Arc::new(LeaderScheduleCache::default()),
&PohConfig::default(),
Arc::new(AtomicBool::default()),
@ -1189,7 +1189,7 @@ mod tests {
Some((4, 4)),
bank.ticks_per_slot(),
&Pubkey::default(),
&Arc::new(blockstore),
Arc::new(blockstore),
&Arc::new(LeaderScheduleCache::new_from_bank(&bank)),
&PohConfig::default(),
Arc::new(AtomicBool::default()),
@ -1219,7 +1219,7 @@ mod tests {
Some((4, 4)),
bank0.ticks_per_slot(),
&Pubkey::default(),
&Arc::new(blockstore),
Arc::new(blockstore),
&Arc::new(LeaderScheduleCache::new_from_bank(&bank0)),
&PohConfig::default(),
Arc::new(AtomicBool::default()),
@ -1282,7 +1282,7 @@ mod tests {
Some((4, 4)),
bank.ticks_per_slot(),
&Pubkey::default(),
&Arc::new(blockstore),
Arc::new(blockstore),
&Arc::new(LeaderScheduleCache::new_from_bank(&bank)),
&PohConfig::default(),
Arc::new(AtomicBool::default()),
@ -1331,7 +1331,7 @@ mod tests {
Some((4, 4)),
bank0.ticks_per_slot(),
&Pubkey::default(),
&Arc::new(blockstore),
Arc::new(blockstore),
&Arc::new(LeaderScheduleCache::new_from_bank(&bank0)),
&PohConfig::default(),
Arc::new(AtomicBool::default()),
@ -1374,7 +1374,7 @@ mod tests {
Some((4, 4)),
bank.ticks_per_slot(),
&Pubkey::default(),
&Arc::new(blockstore),
Arc::new(blockstore),
&Arc::new(LeaderScheduleCache::new_from_bank(&bank)),
&PohConfig::default(),
Arc::new(AtomicBool::default()),
@ -1416,7 +1416,7 @@ mod tests {
Some((4, 4)),
bank0.ticks_per_slot(),
&Pubkey::default(),
&Arc::new(blockstore),
Arc::new(blockstore),
&Arc::new(LeaderScheduleCache::new_from_bank(&bank0)),
&PohConfig::default(),
Arc::new(AtomicBool::default()),
@ -1472,7 +1472,7 @@ mod tests {
Some((4, 4)),
bank.ticks_per_slot(),
&Pubkey::default(),
&Arc::new(blockstore),
Arc::new(blockstore),
&Arc::new(LeaderScheduleCache::new_from_bank(&bank)),
&PohConfig::default(),
Arc::new(AtomicBool::default()),
@ -1512,7 +1512,7 @@ mod tests {
Some((4, 4)),
bank.ticks_per_slot(),
&Pubkey::default(),
&Arc::new(blockstore),
Arc::new(blockstore),
&Arc::new(LeaderScheduleCache::new_from_bank(&bank)),
&PohConfig::default(),
Arc::new(AtomicBool::default()),
@ -1584,7 +1584,7 @@ mod tests {
Some((4, 4)),
bank0.ticks_per_slot(),
&Pubkey::default(),
&Arc::new(blockstore),
Arc::new(blockstore),
&Arc::new(LeaderScheduleCache::new_from_bank(&bank0)),
&PohConfig::default(),
Arc::new(AtomicBool::default()),
@ -1640,7 +1640,7 @@ mod tests {
Some((4, 4)),
DEFAULT_TICKS_PER_SLOT,
&Pubkey::default(),
&Arc::new(blockstore),
Arc::new(blockstore),
&Arc::new(LeaderScheduleCache::default()),
&PohConfig::default(),
Arc::new(AtomicBool::default()),
@ -1669,7 +1669,7 @@ mod tests {
Some((4, 4)),
DEFAULT_TICKS_PER_SLOT,
&Pubkey::default(),
&Arc::new(blockstore),
Arc::new(blockstore),
&Arc::new(LeaderScheduleCache::default()),
&PohConfig::default(),
Arc::new(AtomicBool::default()),
@ -1700,7 +1700,7 @@ mod tests {
Some((4, 4)),
DEFAULT_TICKS_PER_SLOT,
&Pubkey::default(),
&Arc::new(blockstore),
Arc::new(blockstore),
&Arc::new(LeaderScheduleCache::default()),
&PohConfig::default(),
Arc::new(AtomicBool::default()),
@ -1734,7 +1734,7 @@ mod tests {
Some((4, 4)),
bank.ticks_per_slot(),
&Pubkey::default(),
&Arc::new(blockstore),
Arc::new(blockstore),
&Arc::new(LeaderScheduleCache::new_from_bank(&bank)),
&PohConfig::default(),
Arc::new(AtomicBool::default()),
@ -1765,7 +1765,7 @@ mod tests {
None,
bank.ticks_per_slot(),
&Pubkey::default(),
&Arc::new(blockstore),
Arc::new(blockstore),
Some(sender),
&Arc::new(LeaderScheduleCache::default()),
&PohConfig::default(),
@ -1801,7 +1801,7 @@ mod tests {
Some((4, 4)),
bank.ticks_per_slot(),
&Pubkey::default(),
&Arc::new(blockstore),
Arc::new(blockstore),
&Arc::new(LeaderScheduleCache::new_from_bank(&bank)),
&PohConfig::default(),
Arc::new(AtomicBool::default()),
@ -1849,7 +1849,7 @@ mod tests {
None,
bank.ticks_per_slot(),
&Pubkey::default(),
&Arc::new(blockstore),
Arc::new(blockstore),
&leader_schedule_cache,
&PohConfig::default(),
Arc::new(AtomicBool::default()),
@ -1912,7 +1912,7 @@ mod tests {
None,
bank0.ticks_per_slot(),
&Pubkey::default(),
&Arc::new(blockstore),
Arc::new(blockstore),
&Arc::new(LeaderScheduleCache::new_from_bank(&bank0)),
&PohConfig::default(),
Arc::new(AtomicBool::default()),
@ -2073,7 +2073,7 @@ mod tests {
None,
bank.ticks_per_slot(),
&Pubkey::default(),
&Arc::new(blockstore),
Arc::new(blockstore),
&Arc::new(LeaderScheduleCache::new_from_bank(&bank)),
&PohConfig::default(),
Arc::new(AtomicBool::default()),
@ -2125,7 +2125,7 @@ mod tests {
Some((2, 2)),
bank.ticks_per_slot(),
&Pubkey::default(),
&Arc::new(blockstore),
Arc::new(blockstore),
&Arc::new(LeaderScheduleCache::new_from_bank(&bank)),
&PohConfig::default(),
Arc::new(AtomicBool::default()),

View File

@ -431,7 +431,7 @@ mod tests {
Some((4, 4)),
ticks_per_slot,
&Pubkey::default(),
&blockstore,
blockstore,
&leader_schedule_cache,
&poh_config,
exit.clone(),

View File

@ -106,7 +106,7 @@ mod test {
Some((2, 2)),
bank.ticks_per_slot(),
&Pubkey::default(),
&Arc::new(blockstore),
Arc::new(blockstore),
&Arc::new(LeaderScheduleCache::new_from_bank(&bank)),
&PohConfig::default(),
Arc::new(AtomicBool::default()),