Refactor: Sanitized transaction creation (#23558)

* Refactor: SanitizedTransaction::try_create optionally computes hash

* Refactor: Add SimpleAddressLoader
This commit is contained in:
Justin Starry
2022-03-15 12:02:22 +08:00
committed by GitHub
parent f05ac7a899
commit 8c8f9694e0
10 changed files with 81 additions and 55 deletions

View File

@@ -225,7 +225,8 @@ pub(crate) mod tests {
signature::{Keypair, Signature, Signer},
system_transaction,
transaction::{
DisabledAddressLoader, SanitizedTransaction, Transaction, VersionedTransaction,
MessageHash, SanitizedTransaction, SimpleAddressLoader, Transaction,
VersionedTransaction,
},
},
solana_transaction_status::{
@@ -304,14 +305,13 @@ pub(crate) mod tests {
Blockstore::open(&ledger_path).expect("Expected to be able to open database ledger");
let blockstore = Arc::new(blockstore);
let message_hash = Hash::new_unique();
let transaction = build_test_transaction_legacy();
let transaction = VersionedTransaction::from(transaction);
let transaction = SanitizedTransaction::try_create(
transaction,
message_hash,
Some(true),
&DisabledAddressLoader,
MessageHash::Compute,
None,
SimpleAddressLoader::Disabled,
)
.unwrap();