banks-server: Support versioned transactions (#33005)
This commit is contained in:
parent
97d6e6f738
commit
dcad8f01bd
|
@ -93,7 +93,7 @@ impl BanksServer {
|
|||
// has been processed
|
||||
let lock = bank.freeze_lock();
|
||||
if *lock == Hash::default() {
|
||||
let _ = bank.try_process_transactions(transactions.iter());
|
||||
let _ = bank.try_process_entry_transactions(transactions);
|
||||
// break out of inner loop and release bank freeze lock
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -2,8 +2,11 @@ use {
|
|||
solana_program_test::ProgramTest,
|
||||
solana_sdk::{
|
||||
bpf_loader_upgradeable::{self, UpgradeableLoaderState},
|
||||
message::{v0::Message, VersionedMessage},
|
||||
pubkey::Pubkey,
|
||||
signature::{Keypair, Signer},
|
||||
transaction::Transaction,
|
||||
system_instruction,
|
||||
transaction::{Transaction, VersionedTransaction},
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -43,3 +46,39 @@ async fn test_bpf_loader_upgradeable_present() {
|
|||
|
||||
assert_eq!(buffer_account.owner, bpf_loader_upgradeable::id());
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn versioned_transaction() {
|
||||
let program_test = ProgramTest::default();
|
||||
let mut context = program_test.start_with_context().await;
|
||||
|
||||
let program_id = Pubkey::new_unique();
|
||||
let account = Keypair::new();
|
||||
let rent = context.banks_client.get_rent().await.unwrap();
|
||||
let space = 82;
|
||||
let transaction = VersionedTransaction::try_new(
|
||||
VersionedMessage::V0(
|
||||
Message::try_compile(
|
||||
&context.payer.pubkey(),
|
||||
&[system_instruction::create_account(
|
||||
&context.payer.pubkey(),
|
||||
&account.pubkey(),
|
||||
rent.minimum_balance(space),
|
||||
space as u64,
|
||||
&program_id,
|
||||
)],
|
||||
&[],
|
||||
context.last_blockhash,
|
||||
)
|
||||
.unwrap(),
|
||||
),
|
||||
&[&context.payer, &account],
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
context
|
||||
.banks_client
|
||||
.process_transaction(transaction)
|
||||
.await
|
||||
.unwrap();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue