diff --git a/runtime-transaction/src/runtime_transaction.rs b/runtime-transaction/src/runtime_transaction.rs index 14c13138025b31..81e8fe0bc09205 100644 --- a/runtime-transaction/src/runtime_transaction.rs +++ b/runtime-transaction/src/runtime_transaction.rs @@ -116,6 +116,34 @@ impl RuntimeTransaction { } impl RuntimeTransaction { + pub fn try_from_sanitized_transaction(transaction: SanitizedTransaction) -> Result { + let message_hash = *transaction.message_hash(); + let is_simple_vote_tx = transaction.is_simple_vote_transaction(); + let precompile_signature_details = + get_precompile_signature_details(transaction.program_instructions_iter()); + let signature_details = TransactionSignatureDetails::new( + transaction.signatures().len() as u64, + precompile_signature_details.num_secp256k1_instruction_signatures, + precompile_signature_details.num_ed25519_instruction_signatures, + ); + let compute_budget_instruction_details = + ComputeBudgetInstructionDetails::try_from(transaction.program_instructions_iter())?; + + let mut tx = Self { + transaction, + meta: TransactionMeta { + message_hash, + is_simple_vote_tx, + signature_details, + compute_budget_instruction_details, + }, + }; + + tx.load_dynamic_metadata()?; + + Ok(tx) + } + pub fn try_from( statically_loaded_runtime_tx: RuntimeTransaction, address_loader: impl AddressLoader,