From d9a252f141fedd22ef686cf67ad8d56b1b7a898c Mon Sep 17 00:00:00 2001 From: kevinheavey Date: Tue, 9 Apr 2024 17:38:45 +0400 Subject: [PATCH] accept both legacy and versioned tx in simulate_transaction --- src/lib.rs | 9 ++++++--- tests/stake_program.rs | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 972ea54..44c8995 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -724,7 +724,10 @@ impl LiteSVM { } } - pub fn simulate_transaction(&mut self, tx: VersionedTransaction) -> TransactionResult { + pub fn simulate_transaction( + &mut self, + tx: impl Into, + ) -> TransactionResult { let ExecutionResult { post_accounts: _, tx_result, @@ -733,9 +736,9 @@ impl LiteSVM { return_data, .. } = if self.sigverify { - self.execute_transaction(tx) + self.execute_transaction(tx.into()) } else { - self.execute_transaction_no_verify(tx) + self.execute_transaction_no_verify(tx.into()) }; let logs = self.log_collector.take().into_messages(); diff --git a/tests/stake_program.rs b/tests/stake_program.rs index ab57b9a..d28d525 100644 --- a/tests/stake_program.rs +++ b/tests/stake_program.rs @@ -173,7 +173,7 @@ fn get_minimum_delegation(svm: &mut LiteSVM, payer: &Keypair) -> u64 { svm.latest_blockhash(), ); let mut data = svm - .simulate_transaction(transaction.into()) + .simulate_transaction(transaction) .unwrap() .return_data .data;