Skip to content

Commit ea51baf

Browse files
pgarg66mergify[bot]
authored andcommitted
v1.17: Remove unnecessary unwrap from simulate_transaction_unchecked() (backport of #35375) (pyth-network#65)
Remove unnecessary unwrap from `simulate_transaction_unchecked()` (#35375) Remove unnecessary unwrap from simulate_transaction_unchecked() (cherry picked from commit cb260f1) Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
1 parent 7092bd6 commit ea51baf

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

runtime/src/bank.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4384,9 +4384,7 @@ impl Bank {
43844384
let post_simulation_accounts = loaded_transactions
43854385
.into_iter()
43864386
.next()
4387-
.unwrap()
4388-
.0
4389-
.ok()
4387+
.and_then(|(loaded_transactions_res, _)| loaded_transactions_res.ok())
43904388
.map(|loaded_transaction| {
43914389
loaded_transaction
43924390
.accounts
@@ -4406,7 +4404,12 @@ impl Bank {
44064404

44074405
debug!("simulate_transaction: {:?}", timings);
44084406

4409-
let execution_result = execution_results.pop().unwrap();
4407+
let execution_result =
4408+
execution_results
4409+
.pop()
4410+
.unwrap_or(TransactionExecutionResult::NotExecuted(
4411+
TransactionError::InvalidProgramForExecution,
4412+
));
44104413
let flattened_result = execution_result.flattened_result();
44114414
let (logs, return_data) = match execution_result {
44124415
TransactionExecutionResult::Executed { details, .. } => {

0 commit comments

Comments
 (0)