Enable commitment arg on solana deploy (#12532) (#12534)

(cherry picked from commit 35208c5ee7)

Co-authored-by: Tyera Eulberg <teulberg@gmail.com>
This commit is contained in:
mergify[bot]
2020-09-28 23:32:50 +00:00
committed by GitHub
parent 4cf69365b2
commit a550d82202
2 changed files with 14 additions and 6 deletions

View File

@ -15,7 +15,7 @@ pub fn commitment_arg_with_default<'a, 'b>(default_value: &'static str) -> Arg<'
Arg::with_name(COMMITMENT_ARG.name)
.long(COMMITMENT_ARG.long)
.takes_value(true)
.possible_values(&["recent", "single", "root", "max"])
.possible_values(&["recent", "single", "singleGossip", "root", "max"])
.default_value(default_value)
.value_name("COMMITMENT_LEVEL")
.help(COMMITMENT_ARG.help)

View File

@ -1124,6 +1124,7 @@ fn send_and_confirm_transactions_with_spinner<T: Signers>(
rpc_client: &RpcClient,
mut transactions: Vec<Transaction>,
signer_keys: &T,
commitment: CommitmentConfig,
) -> Result<(), Box<dyn error::Error>> {
let progress_bar = new_spinner_progress_bar();
let mut send_retries = 5;
@ -1145,7 +1146,7 @@ fn send_and_confirm_transactions_with_spinner<T: Signers>(
.send_transaction_with_config(
&transaction,
RpcSendTransactionConfig {
skip_preflight: true,
preflight_commitment: Some(commitment.commitment),
..RpcSendTransactionConfig::default()
},
)
@ -1307,9 +1308,15 @@ fn process_deploy(
}
trace!("Writing program data");
send_and_confirm_transactions_with_spinner(&rpc_client, write_transactions, &signers).map_err(
|_| CliError::DynamicProgramError("Data writes to program account failed".to_string()),
)?;
send_and_confirm_transactions_with_spinner(
&rpc_client,
write_transactions,
&signers,
config.commitment,
)
.map_err(|_| {
CliError::DynamicProgramError("Data writes to program account failed".to_string())
})?;
let (blockhash, _, _) = rpc_client
.get_recent_blockhash_with_commitment(config.commitment)?
@ -2521,7 +2528,8 @@ pub fn app<'ab, 'v>(name: &str, about: &'ab str, version: &'v str) -> App<'ab, '
.takes_value(false)
.hidden(true) // Don't document this argument to discourage its use
.help("Use the deprecated BPF loader")
),
)
.arg(commitment_arg_with_default("max")),
)
.subcommand(
SubCommand::with_name("pay")