local-cluster: use feature flag for size for vote accounts (#31723)

This commit is contained in:
Ashwin Sekar 2023-05-18 19:39:28 -07:00 committed by GitHub
parent fd049847a3
commit fb09cba8ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 1 deletions

View File

@ -31,6 +31,7 @@ use {
clock::{DEFAULT_DEV_SLOTS_PER_EPOCH, DEFAULT_TICKS_PER_SLOT},
commitment_config::CommitmentConfig,
epoch_schedule::EpochSchedule,
feature_set,
genesis_config::{ClusterType, GenesisConfig},
message::Message,
poh_config::PohConfig,
@ -656,6 +657,16 @@ impl LocalCluster {
== 0
{
// 1) Create vote account
// Unlike the bootstrap validator we have to check if the new vote state is being used
// as the cluster is already running, and using the wrong account size will cause the
// InitializeAccount tx to fail
let use_current_vote_state = client
.poll_get_balance_with_commitment(
&feature_set::vote_state_add_vote_latency::id(),
CommitmentConfig::processed(),
)
.unwrap_or(0)
> 0;
let instructions = vote_instruction::create_account_with_config(
&from_account.pubkey(),
@ -668,7 +679,8 @@ impl LocalCluster {
},
amount,
vote_instruction::CreateVoteAccountConfig {
space: vote_state::VoteStateVersions::vote_state_size_of(true) as u64,
space: vote_state::VoteStateVersions::vote_state_size_of(use_current_vote_state)
as u64,
..vote_instruction::CreateVoteAccountConfig::default()
},
);