* Deinitialize nonce data upon zero balance (cherry picked from commit3881ae10fb
) * vote: Add helper for creating current-versioned states (cherry picked from commit5b903318b2
) * Deinitialize vote data upon zero balance (cherry picked from commitdb5bd6ea1a
) * Deinitialize stake data upon zero balance (cherry picked from commit50710473a8
) Co-authored-by: Trent Nelson <trent@solana.com>
This commit is contained in:
@@ -204,6 +204,8 @@ impl Accounts {
|
||||
})? {
|
||||
SystemAccountKind::System => 0,
|
||||
SystemAccountKind::Nonce => {
|
||||
// Should we ever allow a fees charge to zero a nonce account's
|
||||
// balance. The state MUST be set to uninitialized in that case
|
||||
rent_collector.rent.minimum_balance(nonce::State::size())
|
||||
}
|
||||
};
|
||||
|
@@ -10731,7 +10731,7 @@ pub(crate) mod tests {
|
||||
let mut vote_account = bank.get_account(vote_pubkey).unwrap_or_default();
|
||||
let mut vote_state = VoteState::from(&vote_account).unwrap_or_default();
|
||||
vote_state.last_timestamp = timestamp;
|
||||
let versioned = VoteStateVersions::Current(Box::new(vote_state));
|
||||
let versioned = VoteStateVersions::new_current(vote_state);
|
||||
VoteState::to(&versioned, &mut vote_account).unwrap();
|
||||
bank.store_account(vote_pubkey, &vote_account);
|
||||
}
|
||||
|
@@ -116,7 +116,7 @@ mod tests {
|
||||
let vote_state = VoteState::new(&vote_init, &clock);
|
||||
let account = Account::new_data(
|
||||
rng.gen(), // lamports
|
||||
&VoteStateVersions::Current(Box::new(vote_state.clone())),
|
||||
&VoteStateVersions::new_current(vote_state.clone()),
|
||||
&Pubkey::new_unique(), // owner
|
||||
)
|
||||
.unwrap();
|
||||
|
Reference in New Issue
Block a user