Skip to content

Commit

Permalink
includes rent_epoch in vote-accounts sanity checks (#29861)
Browse files Browse the repository at this point in the history
#26479
preserves rent epoch for rent-exempt accounts. Since the feature got
activated, vote accounts in stakes-cache have identical rent_epoch field
as the accounts in accounts-db. The commit verifies this in stakes-cache
sanity checks.

(cherry picked from commit 8a14636)
  • Loading branch information
behzadnouri authored and mergify[bot] committed Jan 24, 2023
1 parent 9838806 commit 48ef751
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions runtime/src/stakes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,18 +235,9 @@ impl Stakes<StakeAccount> {
None => return Err(Error::VoteAccountNotFound(*pubkey)),
Some(account) => account,
};
// Ignoring rent_epoch until the feature for
// preserve_rent_epoch_for_rent_exempt_accounts is activated.
let vote_account = vote_account.account();
if vote_account.lamports() != account.lamports()
|| vote_account.owner() != account.owner()
|| vote_account.executable() != account.executable()
|| vote_account.data() != account.data()
{
error!(
"vote account mismatch: {}, {:?}, {:?}",
pubkey, vote_account, account
);
if vote_account != &account {
error!("vote account mismatch: {pubkey}, {vote_account:?}, {account:?}");
return Err(Error::VoteAccountMismatch(*pubkey));
}
}
Expand All @@ -266,7 +257,7 @@ impl Stakes<StakeAccount> {
if VoteState::is_correct_size_and_initialized(account.data())
&& VoteAccount::try_from(account.clone()).is_ok()
{
error!("vote account not cached: {}, {:?}", pubkey, account);
error!("vote account not cached: {pubkey}, {account:?}");
return Err(Error::VoteAccountNotCached(pubkey));
}
}
Expand Down

0 comments on commit 48ef751

Please sign in to comment.