pub struct TransactionSignatureChecker<'a> { /* private fields */ }
Expand description
A SignatureChecker
implementation for transactions.
Implementations§
source§impl<'a> TransactionSignatureChecker<'a>
impl<'a> TransactionSignatureChecker<'a>
sourcepub fn new(tx: &'a Transaction, input_index: usize, input_amount: u64) -> Self
pub fn new(tx: &'a Transaction, input_index: usize, input_amount: u64) -> Self
Constructs a new instance of TransactionSignatureChecker
.
Trait Implementations§
source§impl SignatureChecker for TransactionSignatureChecker<'_>
impl SignatureChecker for TransactionSignatureChecker<'_>
source§fn check_lock_time(&self, lock_time: ScriptNum) -> bool
fn check_lock_time(&self, lock_time: ScriptNum) -> bool
This function verifies that the transaction’s nLockTime
field meets the conditions specified
by the lock_time
parameter.
The lock_time
can represent either a block height or a Unix timestamp, depending on its value:
- If
lock_time < 500,000,000
, it is interpreted as a block height. - If
lock_time >= 500,000,000
, it is interpreted as a Unix timestamp.
The lock is satisfied if:
- The
lock_time
is of the same type (block height or timestamp) as the transaction’snLockTime
. - The
lock_time
is less than or equal to the transaction’snLockTime
. - The transaction’s
nSequence
field for the input is not set to the maximum value (0xFFFFFFFF
), which would disable the time lock.
§Arguments
lock_time
- The absolute time lock to check, represented as a [ScriptNum
].
§Returns
true
if the absolute time lock is satisfied.false
otherwise.
source§fn check_sequence(&self, sequence: ScriptNum) -> bool
fn check_sequence(&self, sequence: ScriptNum) -> bool
The lock is satisfied if:
- The transaction’s version is at least 2 (BIP 68).
- The
sequence
is of the same type (blocks or seconds) as the input’snSequence
. - The
sequence
is less than or equal to the input’snSequence
.
§Arguments
sequence
- The relative time lock to check, represented as a [ScriptNum
].
§Returns
true
if the relative time lock is satisfied.false
otherwise.
source§fn check_ecdsa_signature(
&mut self,
sig: &EcdsaSignature,
pk: &PublicKey,
script_pubkey: &Script,
sig_version: SigVersion,
) -> Result<bool, SignatureError>
fn check_ecdsa_signature( &mut self, sig: &EcdsaSignature, pk: &PublicKey, script_pubkey: &Script, sig_version: SigVersion, ) -> Result<bool, SignatureError>
Checks an ECDSA signature in the context of a Bitcoin transaction. Read more
source§fn check_schnorr_signature(
&mut self,
sig: &SchnorrSignature,
pk: &XOnlyPublicKey,
sig_version: SigVersion,
exec_data: &ScriptExecutionData,
) -> Result<bool, SignatureError>
fn check_schnorr_signature( &mut self, sig: &SchnorrSignature, pk: &XOnlyPublicKey, sig_version: SigVersion, exec_data: &ScriptExecutionData, ) -> Result<bool, SignatureError>
Checks a Schnorr signature in the context of a Bitcoin transaction. Read more
source§fn verify_ecdsa_signature(
&self,
sig: &EcdsaSignature,
msg: &Message,
pk: &PublicKey,
) -> bool
fn verify_ecdsa_signature( &self, sig: &EcdsaSignature, msg: &Message, pk: &PublicKey, ) -> bool
Verifies an ECDSA signature against a message and public key. Read more
source§fn verify_schnorr_signature(
&self,
sig: &SchnorrSignature,
msg: &Message,
pk: &XOnlyPublicKey,
) -> bool
fn verify_schnorr_signature( &self, sig: &SchnorrSignature, msg: &Message, pk: &XOnlyPublicKey, ) -> bool
Verifies a Schnorr signature against a message and public key. Read more
Auto Trait Implementations§
impl<'a> Freeze for TransactionSignatureChecker<'a>
impl<'a> RefUnwindSafe for TransactionSignatureChecker<'a>
impl<'a> Send for TransactionSignatureChecker<'a>
impl<'a> Sync for TransactionSignatureChecker<'a>
impl<'a> Unpin for TransactionSignatureChecker<'a>
impl<'a> UnwindSafe for TransactionSignatureChecker<'a>
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
Mutably borrows from an owned value. Read more