Use skip_preflight for CLI transactions
The preflight bank is set to max committment level, so we wouldn't see previous txs with single confirmation.
This commit is contained in:
parent
e0533c70c5
commit
fbf6e17d3e
|
@ -18,6 +18,7 @@ use solana_clap_utils::{
|
||||||
};
|
};
|
||||||
use solana_client::client_error::ClientError;
|
use solana_client::client_error::ClientError;
|
||||||
use solana_client::{rpc_client::RpcClient, rpc_request::TokenAccountsFilter};
|
use solana_client::{rpc_client::RpcClient, rpc_request::TokenAccountsFilter};
|
||||||
|
use solana_client::rpc_config::RpcSendTransactionConfig;
|
||||||
use solana_sdk::system_instruction::create_account;
|
use solana_sdk::system_instruction::create_account;
|
||||||
use solana_sdk::{
|
use solana_sdk::{
|
||||||
commitment_config::CommitmentConfig,
|
commitment_config::CommitmentConfig,
|
||||||
|
@ -27,6 +28,7 @@ use solana_sdk::{
|
||||||
system_instruction,
|
system_instruction,
|
||||||
transaction::Transaction,
|
transaction::Transaction,
|
||||||
};
|
};
|
||||||
|
|
||||||
use spl_token::{
|
use spl_token::{
|
||||||
self,
|
self,
|
||||||
instruction::*,
|
instruction::*,
|
||||||
|
@ -1059,7 +1061,7 @@ fn main() {
|
||||||
rpc_client: RpcClient::new(json_rpc_url),
|
rpc_client: RpcClient::new(json_rpc_url),
|
||||||
owner,
|
owner,
|
||||||
fee_payer,
|
fee_payer,
|
||||||
commitment_config: CommitmentConfig::max(),
|
commitment_config: CommitmentConfig::single(),
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1193,9 +1195,13 @@ fn main() {
|
||||||
// confirmation by default for better UX
|
// confirmation by default for better UX
|
||||||
let signature = config
|
let signature = config
|
||||||
.rpc_client
|
.rpc_client
|
||||||
.send_and_confirm_transaction_with_spinner_and_commitment(
|
.send_and_confirm_transaction_with_spinner_and_config(
|
||||||
&transaction,
|
&transaction,
|
||||||
config.commitment_config,
|
config.commitment_config,
|
||||||
|
RpcSendTransactionConfig {
|
||||||
|
// TODO: move to https://github.com/solana-labs/solana/pull/11792
|
||||||
|
skip_preflight: true,
|
||||||
|
},
|
||||||
)?;
|
)?;
|
||||||
println!("Signature: {}", signature);
|
println!("Signature: {}", signature);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,6 @@ bridge_address=Bridge1p5gheXUvJ6jGWGeCsgPKgnE3YgdGKRVCMY9o
|
||||||
initial_guardian=befa429d57cd18b7f8a4d91a2da9ab4af05d0fbe
|
initial_guardian=befa429d57cd18b7f8a4d91a2da9ab4af05d0fbe
|
||||||
chain_id_ethereum=2
|
chain_id_ethereum=2
|
||||||
|
|
||||||
# TODO: use proper confirmation level to avoid retries (except for faucet, which waits for devnet to come up)
|
|
||||||
retry () {
|
retry () {
|
||||||
while ! $@; do
|
while ! $@; do
|
||||||
sleep 1
|
sleep 1
|
||||||
|
@ -41,10 +40,10 @@ account=$(cli create-account "$token" | grep 'Creating account' | awk '{ print $
|
||||||
echo "Created token account $account"
|
echo "Created token account $account"
|
||||||
|
|
||||||
# Mint new tokens owned by our CLI account
|
# Mint new tokens owned by our CLI account
|
||||||
retry cli mint "$token" 10000000000 "$account"
|
cli mint "$token" 10000000000 "$account"
|
||||||
|
|
||||||
# Do lock transactions <3
|
# Do lock transactions <3
|
||||||
while : ; do
|
while : ; do
|
||||||
cli lock "$bridge_address" "$account" "$token" 10 "$chain_id_ethereum" "$RANDOM"
|
cli lock "$bridge_address" "$account" "$token" 10 "$chain_id_ethereum" "$RANDOM"
|
||||||
sleep 1
|
sleep 5
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in New Issue