Use check_unique_pubkeys helper to prevent DuplicateAccountIndex errors earlier (#5532)
This commit is contained in:
@ -563,6 +563,10 @@ fn process_create_vote_account(
|
|||||||
(vote_account_pubkey, "vote_account_pubkey".to_string()),
|
(vote_account_pubkey, "vote_account_pubkey".to_string()),
|
||||||
(node_pubkey, "node_pubkey".to_string()),
|
(node_pubkey, "node_pubkey".to_string()),
|
||||||
)?;
|
)?;
|
||||||
|
check_unique_pubkeys(
|
||||||
|
(&config.keypair.pubkey(), "wallet keypair".to_string()),
|
||||||
|
(vote_account_pubkey, "vote_account_pubkey".to_string()),
|
||||||
|
)?;
|
||||||
let ixs = vote_instruction::create_account(
|
let ixs = vote_instruction::create_account(
|
||||||
&config.keypair.pubkey(),
|
&config.keypair.pubkey(),
|
||||||
vote_account_pubkey,
|
vote_account_pubkey,
|
||||||
@ -734,6 +738,13 @@ fn process_delegate_stake(
|
|||||||
lamports: u64,
|
lamports: u64,
|
||||||
force: bool,
|
force: bool,
|
||||||
) -> ProcessResult {
|
) -> ProcessResult {
|
||||||
|
check_unique_pubkeys(
|
||||||
|
(&config.keypair.pubkey(), "wallet keypair".to_string()),
|
||||||
|
(
|
||||||
|
&stake_account_keypair.pubkey(),
|
||||||
|
"stake_account_keypair".to_string(),
|
||||||
|
),
|
||||||
|
)?;
|
||||||
let (recent_blockhash, fee_calculator) = rpc_client.get_recent_blockhash()?;
|
let (recent_blockhash, fee_calculator) = rpc_client.get_recent_blockhash()?;
|
||||||
|
|
||||||
let ixs = stake_instruction::create_stake_account_and_delegate_stake(
|
let ixs = stake_instruction::create_stake_account_and_delegate_stake(
|
||||||
@ -887,6 +898,13 @@ fn process_create_replicator_storage_account(
|
|||||||
account_owner: &Pubkey,
|
account_owner: &Pubkey,
|
||||||
storage_account_pubkey: &Pubkey,
|
storage_account_pubkey: &Pubkey,
|
||||||
) -> ProcessResult {
|
) -> ProcessResult {
|
||||||
|
check_unique_pubkeys(
|
||||||
|
(&config.keypair.pubkey(), "wallet keypair".to_string()),
|
||||||
|
(
|
||||||
|
&storage_account_pubkey,
|
||||||
|
"storage_account_pubkey".to_string(),
|
||||||
|
),
|
||||||
|
)?;
|
||||||
let (recent_blockhash, fee_calculator) = rpc_client.get_recent_blockhash()?;
|
let (recent_blockhash, fee_calculator) = rpc_client.get_recent_blockhash()?;
|
||||||
let ixs = storage_instruction::create_replicator_storage_account(
|
let ixs = storage_instruction::create_replicator_storage_account(
|
||||||
&config.keypair.pubkey(),
|
&config.keypair.pubkey(),
|
||||||
@ -907,6 +925,13 @@ fn process_create_validator_storage_account(
|
|||||||
account_owner: &Pubkey,
|
account_owner: &Pubkey,
|
||||||
storage_account_pubkey: &Pubkey,
|
storage_account_pubkey: &Pubkey,
|
||||||
) -> ProcessResult {
|
) -> ProcessResult {
|
||||||
|
check_unique_pubkeys(
|
||||||
|
(&config.keypair.pubkey(), "wallet keypair".to_string()),
|
||||||
|
(
|
||||||
|
&storage_account_pubkey,
|
||||||
|
"storage_account_pubkey".to_string(),
|
||||||
|
),
|
||||||
|
)?;
|
||||||
let (recent_blockhash, fee_calculator) = rpc_client.get_recent_blockhash()?;
|
let (recent_blockhash, fee_calculator) = rpc_client.get_recent_blockhash()?;
|
||||||
let ixs = storage_instruction::create_validator_storage_account(
|
let ixs = storage_instruction::create_validator_storage_account(
|
||||||
&config.keypair.pubkey(),
|
&config.keypair.pubkey(),
|
||||||
@ -1053,6 +1078,10 @@ fn process_pay(
|
|||||||
witnesses: &Option<Vec<Pubkey>>,
|
witnesses: &Option<Vec<Pubkey>>,
|
||||||
cancelable: Option<Pubkey>,
|
cancelable: Option<Pubkey>,
|
||||||
) -> ProcessResult {
|
) -> ProcessResult {
|
||||||
|
check_unique_pubkeys(
|
||||||
|
(&config.keypair.pubkey(), "wallet keypair".to_string()),
|
||||||
|
(to, "to".to_string()),
|
||||||
|
)?;
|
||||||
let (blockhash, fee_calculator) = rpc_client.get_recent_blockhash()?;
|
let (blockhash, fee_calculator) = rpc_client.get_recent_blockhash()?;
|
||||||
|
|
||||||
if timestamp == None && *witnesses == None {
|
if timestamp == None && *witnesses == None {
|
||||||
|
Reference in New Issue
Block a user