Clean up sanitized tx creation for tests (#21006)

This commit is contained in:
Justin Starry
2021-10-27 13:09:16 -04:00
committed by GitHub
parent 9d330fc638
commit 036d7fcc81
11 changed files with 134 additions and 144 deletions

View File

@@ -163,16 +163,11 @@ mod tests {
hash::Hash, message::Message, pubkey::Pubkey, signature::Keypair, signer::Signer,
transaction::Transaction,
};
use std::convert::TryInto;
fn sanitize_tx(tx: Transaction) -> SanitizedTransaction {
tx.try_into().unwrap()
}
macro_rules! test {
( $instructions: expr, $expected_error: expr, $expected_budget: expr ) => {
let payer_keypair = Keypair::new();
let tx = sanitize_tx(Transaction::new(
let tx = SanitizedTransaction::from_transaction_for_tests(Transaction::new(
&[&payer_keypair],
Message::new($instructions, Some(&payer_keypair.pubkey())),
Hash::default(),