Drop bank from BlockCommitmentCache (#10959)

* Remove bank reference from BlockCommitmentCache

* Don't use a Bank to create BlockCommitmentCache

* Rename recent_slot to slot
This commit is contained in:
Greg Fitzgerald
2020-07-08 18:50:13 -06:00
committed by GitHub
parent 841ecfd927
commit ebadbce920
5 changed files with 27 additions and 37 deletions

View File

@ -116,7 +116,7 @@ impl AggregateCommitmentService {
block_commitment,
highest_confirmed_root,
aggregation_data.total_stake,
aggregation_data.bank,
aggregation_data.bank.slot(),
aggregation_data.root,
aggregation_data.root,
);

View File

@ -183,7 +183,7 @@ impl JsonRpcRequestProcessor {
HashMap::new(),
0,
0,
bank.clone(),
bank.slot(),
0,
0,
))),
@ -1798,7 +1798,7 @@ pub mod tests {
block_commitment,
0,
10,
bank.clone(),
bank.slot(),
0,
0,
)));
@ -3326,7 +3326,7 @@ pub mod tests {
block_commitment,
0,
42,
bank_forks.read().unwrap().working_bank(),
bank_forks.read().unwrap().highest_slot(),
0,
0,
)));
@ -3830,7 +3830,7 @@ pub mod tests {
block_commitment,
highest_confirmed_root,
50,
bank.clone(),
bank.slot(),
0,
0,
);

View File

@ -525,9 +525,8 @@ mod tests {
subscriptions: Arc::new(RpcSubscriptions::new(
&Arc::new(AtomicBool::new(false)),
bank_forks.clone(),
Arc::new(RwLock::new(BlockCommitmentCache::new_for_tests_with_bank(
bank_forks.read().unwrap().get(1).unwrap().clone(),
1,
Arc::new(RwLock::new(BlockCommitmentCache::new_for_tests_with_slots(
1, 1,
))),
)),
uid: Arc::new(atomic::AtomicUsize::default()),

View File

@ -961,9 +961,8 @@ pub(crate) mod tests {
let subscriptions = RpcSubscriptions::new(
&exit,
bank_forks.clone(),
Arc::new(RwLock::new(BlockCommitmentCache::new_for_tests_with_bank(
bank_forks.read().unwrap().get(1).unwrap().clone(),
1,
Arc::new(RwLock::new(BlockCommitmentCache::new_for_tests_with_slots(
1, 1,
))),
);
subscriptions.add_account_subscription(
@ -1158,7 +1157,7 @@ pub(crate) mod tests {
block_commitment.entry(0).or_insert(cache0);
block_commitment.entry(1).or_insert(cache1);
let block_commitment_cache =
BlockCommitmentCache::new(block_commitment, 0, 10, bank1, 0, 0);
BlockCommitmentCache::new(block_commitment, 0, 10, bank1.slot(), 0, 0);
let exit = Arc::new(AtomicBool::new(false));
let subscriptions = RpcSubscriptions::new(
@ -1433,9 +1432,8 @@ pub(crate) mod tests {
let subscriptions = RpcSubscriptions::new(
&exit,
bank_forks.clone(),
Arc::new(RwLock::new(BlockCommitmentCache::new_for_tests_with_bank(
bank_forks.read().unwrap().get(1).unwrap().clone(),
1,
Arc::new(RwLock::new(BlockCommitmentCache::new_for_tests_with_slots(
1, 1,
))),
);
let sub_id0 = SubscriptionId::Number(0 as u64);