Handle removing slots during account scans (#17471) (#17953)

(cherry picked from commit ccc013e134)

Co-authored-by: carllin <carl@solana.com>
This commit is contained in:
mergify[bot]
2021-06-22 00:59:12 +00:00
committed by GitHub
parent 0cbf7bef1e
commit 6f376489a5
15 changed files with 937 additions and 321 deletions

View File

@@ -1972,8 +1972,10 @@ fn main() {
}
if remove_stake_accounts {
for (address, mut account) in
bank.get_program_accounts(&stake::program::id()).into_iter()
for (address, mut account) in bank
.get_program_accounts(&stake::program::id())
.unwrap()
.into_iter()
{
account.set_lamports(0);
bank.store_account(&address, &account);
@@ -2006,6 +2008,7 @@ fn main() {
// Delete existing vote accounts
for (address, mut account) in bank
.get_program_accounts(&solana_vote_program::id())
.unwrap()
.into_iter()
{
account.set_lamports(0);
@@ -2167,6 +2170,7 @@ fn main() {
let accounts: BTreeMap<_, _> = bank
.get_all_accounts_with_modified_slots()
.unwrap()
.into_iter()
.filter(|(pubkey, _account, _slot)| {
include_sysvars || !solana_sdk::sysvar::is_sysvar_id(pubkey)