@@ -1,7 +1,7 @@
|
||||
use solana_sdk::{
|
||||
account::Account, account_utils::State, hash::Hash, instruction::CompiledInstruction,
|
||||
instruction_processor_utils::limited_deserialize, nonce_instruction::NonceInstruction,
|
||||
nonce_program, nonce_state::NonceState, pubkey::Pubkey, transaction::Transaction,
|
||||
instruction_processor_utils::limited_deserialize, nonce_state::NonceState, pubkey::Pubkey,
|
||||
system_instruction::SystemInstruction, system_program, transaction::Transaction,
|
||||
};
|
||||
|
||||
pub fn transaction_uses_durable_nonce(tx: &Transaction) -> Option<&CompiledInstruction> {
|
||||
@@ -12,12 +12,12 @@ pub fn transaction_uses_durable_nonce(tx: &Transaction) -> Option<&CompiledInstr
|
||||
.filter(|maybe_ix| {
|
||||
let prog_id_idx = maybe_ix.program_id_index as usize;
|
||||
match message.account_keys.get(prog_id_idx) {
|
||||
Some(program_id) => nonce_program::check_id(&program_id),
|
||||
Some(program_id) => system_program::check_id(&program_id),
|
||||
_ => false,
|
||||
}
|
||||
})
|
||||
.filter(|maybe_ix| match limited_deserialize(&maybe_ix.data) {
|
||||
Ok(NonceInstruction::Nonce) => true,
|
||||
Ok(SystemInstruction::NonceAdvance) => true,
|
||||
_ => false,
|
||||
})
|
||||
}
|
||||
@@ -44,7 +44,6 @@ mod tests {
|
||||
use super::*;
|
||||
use solana_sdk::{
|
||||
hash::Hash,
|
||||
nonce_instruction,
|
||||
nonce_state::{with_test_keyed_account, NonceAccount},
|
||||
pubkey::Pubkey,
|
||||
signature::{Keypair, KeypairUtil},
|
||||
@@ -61,7 +60,7 @@ mod tests {
|
||||
let tx = Transaction::new_signed_instructions(
|
||||
&[&from_keypair, &nonce_keypair],
|
||||
vec![
|
||||
nonce_instruction::nonce(&nonce_pubkey, &nonce_pubkey),
|
||||
system_instruction::nonce_advance(&nonce_pubkey, &nonce_pubkey),
|
||||
system_instruction::transfer(&from_pubkey, &nonce_pubkey, 42),
|
||||
],
|
||||
Hash::default(),
|
||||
@@ -99,7 +98,7 @@ mod tests {
|
||||
&[&from_keypair, &nonce_keypair],
|
||||
vec![
|
||||
system_instruction::transfer(&from_pubkey, &nonce_pubkey, 42),
|
||||
nonce_instruction::nonce(&nonce_pubkey, &nonce_pubkey),
|
||||
system_instruction::nonce_advance(&nonce_pubkey, &nonce_pubkey),
|
||||
],
|
||||
Hash::default(),
|
||||
);
|
||||
@@ -115,7 +114,7 @@ mod tests {
|
||||
let tx = Transaction::new_signed_instructions(
|
||||
&[&from_keypair, &nonce_keypair],
|
||||
vec![
|
||||
nonce_instruction::withdraw(&nonce_pubkey, &nonce_pubkey, &from_pubkey, 42),
|
||||
system_instruction::nonce_withdraw(&nonce_pubkey, &nonce_pubkey, &from_pubkey, 42),
|
||||
system_instruction::transfer(&from_pubkey, &nonce_pubkey, 42),
|
||||
],
|
||||
Hash::default(),
|
||||
@@ -162,7 +161,7 @@ mod tests {
|
||||
let recent_blockhashes = create_test_recent_blockhashes(0);
|
||||
let authorized = nonce_account.unsigned_key().clone();
|
||||
nonce_account
|
||||
.initialize(&authorized, &recent_blockhashes, &Rent::free())
|
||||
.nonce_initialize(&authorized, &recent_blockhashes, &Rent::free())
|
||||
.unwrap();
|
||||
assert!(verify_nonce(&nonce_account.account, &recent_blockhashes[0]));
|
||||
});
|
||||
@@ -186,7 +185,7 @@ mod tests {
|
||||
let recent_blockhashes = create_test_recent_blockhashes(0);
|
||||
let authorized = nonce_account.unsigned_key().clone();
|
||||
nonce_account
|
||||
.initialize(&authorized, &recent_blockhashes, &Rent::free())
|
||||
.nonce_initialize(&authorized, &recent_blockhashes, &Rent::free())
|
||||
.unwrap();
|
||||
assert!(!verify_nonce(
|
||||
&nonce_account.account,
|
||||
|
Reference in New Issue
Block a user