Skip to content

Commit

Permalink
v1.17: Remove unnecessary unwrap from `simulate_transaction_unchecked…
Browse files Browse the repository at this point in the history
…()` (backport of #35375) (#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>
  • Loading branch information
2 people authored and willhickey committed Mar 9, 2024
1 parent 7092bd6 commit ea51baf
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4384,9 +4384,7 @@ impl Bank {
let post_simulation_accounts = loaded_transactions
.into_iter()
.next()
.unwrap()
.0
.ok()
.and_then(|(loaded_transactions_res, _)| loaded_transactions_res.ok())
.map(|loaded_transaction| {
loaded_transaction
.accounts
Expand All @@ -4406,7 +4404,12 @@ impl Bank {

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

let execution_result = execution_results.pop().unwrap();
let execution_result =
execution_results
.pop()
.unwrap_or(TransactionExecutionResult::NotExecuted(
TransactionError::InvalidProgramForExecution,
));
let flattened_result = execution_result.flattened_result();
let (logs, return_data) = match execution_result {
TransactionExecutionResult::Executed { details, .. } => {
Expand Down

0 comments on commit ea51baf

Please sign in to comment.