pub struct SanitizedTransaction { /* private fields */ }Expand description
Sanitized transaction and the hash of its message
Implementations§
Source§impl SanitizedTransaction
impl SanitizedTransaction
Sourcepub fn try_new(
tx: SanitizedVersionedTransaction,
message_hash: Hash,
is_simple_vote_tx: bool,
address_loader: impl AddressLoader,
reserved_account_keys: &HashSet<Address>,
) -> Result<SanitizedTransaction, TransactionError>
pub fn try_new( tx: SanitizedVersionedTransaction, message_hash: Hash, is_simple_vote_tx: bool, address_loader: impl AddressLoader, reserved_account_keys: &HashSet<Address>, ) -> Result<SanitizedTransaction, TransactionError>
Create a sanitized transaction from a sanitized versioned transaction. If the input transaction uses address tables, attempt to lookup the address for each table index.
Sourcepub fn try_create(
tx: VersionedTransaction,
message_hash: impl Into<MessageHash>,
is_simple_vote_tx: Option<bool>,
address_loader: impl AddressLoader,
reserved_account_keys: &HashSet<Address>,
) -> Result<SanitizedTransaction, TransactionError>
pub fn try_create( tx: VersionedTransaction, message_hash: impl Into<MessageHash>, is_simple_vote_tx: Option<bool>, address_loader: impl AddressLoader, reserved_account_keys: &HashSet<Address>, ) -> Result<SanitizedTransaction, TransactionError>
Create a sanitized transaction from an un-sanitized versioned transaction. If the input transaction uses address tables, attempt to lookup the address for each table index.
Sourcepub fn try_from_legacy_transaction(
tx: Transaction,
reserved_account_keys: &HashSet<Address>,
) -> Result<SanitizedTransaction, TransactionError>
pub fn try_from_legacy_transaction( tx: Transaction, reserved_account_keys: &HashSet<Address>, ) -> Result<SanitizedTransaction, TransactionError>
Create a sanitized transaction from a legacy transaction
Sourcepub fn from_transaction_for_tests(tx: Transaction) -> SanitizedTransaction
pub fn from_transaction_for_tests(tx: Transaction) -> SanitizedTransaction
Create a sanitized transaction from a legacy transaction. Used for tests only.
Sourcepub fn try_new_from_fields(
message: SanitizedMessage,
message_hash: Hash,
is_simple_vote_tx: bool,
signatures: Vec<Signature>,
) -> Result<SanitizedTransaction, TransactionError>
pub fn try_new_from_fields( message: SanitizedMessage, message_hash: Hash, is_simple_vote_tx: bool, signatures: Vec<Signature>, ) -> Result<SanitizedTransaction, TransactionError>
Create a sanitized transaction from fields. Performs only basic signature sanitization.
Sourcepub fn signature(&self) -> &Signature
pub fn signature(&self) -> &Signature
Return the first signature for this transaction.
Notes:
Sanitized transactions must have at least one signature because the
number of signatures must be greater than or equal to the message header
value num_required_signatures which must be greater than 0 itself.
Sourcepub fn signatures(&self) -> &[Signature]
pub fn signatures(&self) -> &[Signature]
Return the list of signatures for this transaction
Sourcepub fn message(&self) -> &SanitizedMessage
pub fn message(&self) -> &SanitizedMessage
Return the signed message
Sourcepub fn message_hash(&self) -> &Hash
pub fn message_hash(&self) -> &Hash
Return the hash of the signed message
Sourcepub fn is_simple_vote_transaction(&self) -> bool
pub fn is_simple_vote_transaction(&self) -> bool
Returns true if this transaction is a simple vote
Sourcepub fn to_versioned_transaction(&self) -> VersionedTransaction
pub fn to_versioned_transaction(&self) -> VersionedTransaction
Convert this sanitized transaction into a versioned transaction for recording in the ledger.
Sourcepub fn get_account_locks(
&self,
tx_account_lock_limit: usize,
) -> Result<TransactionAccountLocks<'_>, TransactionError>
pub fn get_account_locks( &self, tx_account_lock_limit: usize, ) -> Result<TransactionAccountLocks<'_>, TransactionError>
Validate and return the account keys locked by this transaction
Sourcepub fn get_account_locks_unchecked(&self) -> TransactionAccountLocks<'_>
pub fn get_account_locks_unchecked(&self) -> TransactionAccountLocks<'_>
Return the list of accounts that must be locked during processing this transaction.
Sourcepub fn get_loaded_addresses(&self) -> LoadedAddresses
pub fn get_loaded_addresses(&self) -> LoadedAddresses
Return the list of addresses loaded from on-chain address lookup tables
Sourcepub fn get_durable_nonce(&self) -> Option<&Address>
pub fn get_durable_nonce(&self) -> Option<&Address>
If the transaction uses a durable nonce, return the pubkey of the nonce account
Sourcepub fn verify(&self) -> Result<(), TransactionError>
pub fn verify(&self) -> Result<(), TransactionError>
Verify the transaction signatures
Sourcepub fn validate_account_locks(
message: &SanitizedMessage,
tx_account_lock_limit: usize,
) -> Result<(), TransactionError>
pub fn validate_account_locks( message: &SanitizedMessage, tx_account_lock_limit: usize, ) -> Result<(), TransactionError>
Validate a transaction message against locked accounts
Trait Implementations§
Source§impl Clone for SanitizedTransaction
impl Clone for SanitizedTransaction
Source§fn clone(&self) -> SanitizedTransaction
fn clone(&self) -> SanitizedTransaction
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SanitizedTransaction
impl Debug for SanitizedTransaction
Source§impl PartialEq for SanitizedTransaction
impl PartialEq for SanitizedTransaction
Source§fn eq(&self, other: &SanitizedTransaction) -> bool
fn eq(&self, other: &SanitizedTransaction) -> bool
self and other values to be equal, and is used by ==.Source§impl SVMMessage for SanitizedTransaction
impl SVMMessage for SanitizedTransaction
Source§fn num_transaction_signatures(&self) -> u64
fn num_transaction_signatures(&self) -> u64
Source§fn num_write_locks(&self) -> u64
fn num_write_locks(&self) -> u64
Source§fn recent_blockhash(&self) -> &Hash
fn recent_blockhash(&self) -> &Hash
Source§fn num_instructions(&self) -> usize
fn num_instructions(&self) -> usize
Source§fn instructions_iter(&self) -> impl Iterator<Item = SVMInstruction<'_>>
fn instructions_iter(&self) -> impl Iterator<Item = SVMInstruction<'_>>
Source§fn program_instructions_iter(
&self,
) -> impl Iterator<Item = (&Address, SVMInstruction<'_>)> + Clone
fn program_instructions_iter( &self, ) -> impl Iterator<Item = (&Address, SVMInstruction<'_>)> + Clone
Source§fn static_account_keys(&self) -> &[Address]
fn static_account_keys(&self) -> &[Address]
Source§fn account_keys(&self) -> AccountKeys<'_>
fn account_keys(&self) -> AccountKeys<'_>
Source§fn is_writable(&self, index: usize) -> bool
fn is_writable(&self, index: usize) -> bool
true if the account at index is writable.Source§fn is_invoked(&self, key_index: usize) -> bool
fn is_invoked(&self, key_index: usize) -> bool
Source§fn num_lookup_tables(&self) -> usize
fn num_lookup_tables(&self) -> usize
Source§fn message_address_table_lookups(
&self,
) -> impl Iterator<Item = SVMMessageAddressTableLookup<'_>>
fn message_address_table_lookups( &self, ) -> impl Iterator<Item = SVMMessageAddressTableLookup<'_>>
Source§fn num_ed25519_signatures(&self) -> u64
fn num_ed25519_signatures(&self) -> u64
Source§fn num_secp256k1_signatures(&self) -> u64
fn num_secp256k1_signatures(&self) -> u64
Source§fn num_secp256r1_signatures(&self) -> u64
fn num_secp256r1_signatures(&self) -> u64
Source§fn is_instruction_account(&self, key_index: usize) -> bool
fn is_instruction_account(&self, key_index: usize) -> bool
impl Eq for SanitizedTransaction
impl StructuralPartialEq for SanitizedTransaction
Auto Trait Implementations§
impl Freeze for SanitizedTransaction
impl RefUnwindSafe for SanitizedTransaction
impl Send for SanitizedTransaction
impl Sync for SanitizedTransaction
impl Unpin for SanitizedTransaction
impl UnsafeUnpin for SanitizedTransaction
impl UnwindSafe for SanitizedTransaction
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more