Move slot cleanup to AccountsBackgroundService (#13911)

* Move bank drop to AccountsBackgroundService

* Send to ABS on drop instead, protects against other places banks are dropped

* Fix Abi

* test

Co-authored-by: Carl Lin <carl@solana.com>
This commit is contained in:
carllin
2020-12-12 17:22:34 -08:00
committed by GitHub
parent 549a3107cb
commit 55fc963595
11 changed files with 297 additions and 67 deletions

View File

@ -249,6 +249,7 @@ mod tests {
use super::*;
use solana_ledger::genesis_utils::{create_genesis_config, GenesisConfigInfo};
use solana_runtime::{
accounts_background_service::ABSRequestSender,
bank_forks::BankForks,
genesis_utils::{create_genesis_config_with_vote_accounts, ValidatorVoteKeypairs},
};
@ -539,7 +540,7 @@ mod tests {
&working_bank,
);
for x in 0..root {
bank_forks.set_root(x, &None, None);
bank_forks.set_root(x, &ABSRequestSender::default(), None);
}
// Add an additional bank/vote that will root slot 2
@ -576,7 +577,11 @@ mod tests {
.read()
.unwrap()
.highest_confirmed_root();
bank_forks.set_root(root, &None, Some(highest_confirmed_root));
bank_forks.set_root(
root,
&ABSRequestSender::default(),
Some(highest_confirmed_root),
);
let highest_confirmed_root_bank = bank_forks.get(highest_confirmed_root);
assert!(highest_confirmed_root_bank.is_some());
@ -641,7 +646,11 @@ mod tests {
.read()
.unwrap()
.highest_confirmed_root();
bank_forks.set_root(root, &None, Some(highest_confirmed_root));
bank_forks.set_root(
root,
&ABSRequestSender::default(),
Some(highest_confirmed_root),
);
let highest_confirmed_root_bank = bank_forks.get(highest_confirmed_root);
assert!(highest_confirmed_root_bank.is_some());
}