Set drop callback on first root bank (#23999) (#24129)

(cherry picked from commit 4ea59d8cb4)

Co-authored-by: carllin <carl@solana.com>
This commit is contained in:
mergify[bot]
2022-04-05 20:32:17 +00:00
committed by GitHub
parent 3f3e1b30d6
commit c5541efdc2
5 changed files with 104 additions and 59 deletions

View File

@ -6716,10 +6716,7 @@ impl Drop for Bank {
if let Some(drop_callback) = self.drop_callback.read().unwrap().0.as_ref() {
drop_callback.callback(self);
} else {
// Default case
// 1. Tests
// 2. At startup when replaying blockstore and there's no
// AccountsBackgroundService to perform cleanups yet.
// Default case for tests
self.rc
.accounts
.purge_slot(self.slot(), self.bank_id(), false);