RPC: Allow the sendTransaction preflight commitment level to be configured (bp #11792) (#11794)

* Allow the sendTransaction preflight commitment level to be configured

(cherry picked from commit b660704faa)

* rebase

Co-authored-by: Michael Vines <mvines@gmail.com>
This commit is contained in:
mergify[bot]
2020-08-22 16:41:25 +00:00
committed by GitHub
parent 08a789323f
commit 132550cd7a
6 changed files with 17 additions and 2 deletions

View File

@@ -2137,7 +2137,10 @@ impl RpcSol for RpcSolImpl {
.into());
}
if let (Err(err), _log_output) = bank.simulate_transaction(transaction.clone()) {
let preflight_bank = &*meta.bank(config.preflight_commitment);
if let (Err(err), _log_output) =
preflight_bank.simulate_transaction(transaction.clone())
{
// Note: it's possible that the transaction simulation failed but the actual
// transaction would succeed, such as when a transaction depends on an earlier
// transaction that has yet to reach max confirmations. In these cases the user
@@ -2169,7 +2172,7 @@ impl RpcSol for RpcSolImpl {
Ok(())
};
let bank = &*meta.bank(None);
let bank = &*meta.bank(config.commitment);
let logs = if result.is_ok() {
let (transaction_result, log_messages) = bank.simulate_transaction(transaction);
result = transaction_result;