pub trait TxContext {
// Required methods
fn verify_signature(
&self,
full_sig: &[u8],
pub_key: &[u8],
sub_script: &Script,
input_idx: usize,
sighash_flag: u32,
) -> Result<bool, InterpreterError>;
fn lock_time(&self) -> u32;
fn tx_version(&self) -> u32;
fn input_sequence(&self, input_idx: usize) -> u32;
}Expand description
Transaction context trait — provides signature verification without circular dependency on bsv-transaction.
Implementors provide the transaction data needed for OP_CHECKSIG, OP_CHECKMULTISIG, OP_CHECKLOCKTIMEVERIFY, and OP_CHECKSEQUENCEVERIFY.
Required Methods§
Sourcefn verify_signature(
&self,
full_sig: &[u8],
pub_key: &[u8],
sub_script: &Script,
input_idx: usize,
sighash_flag: u32,
) -> Result<bool, InterpreterError>
fn verify_signature( &self, full_sig: &[u8], pub_key: &[u8], sub_script: &Script, input_idx: usize, sighash_flag: u32, ) -> Result<bool, InterpreterError>
Verify a signature against a public key for the given input.
full_sig includes the sighash flag byte at the end.
pub_key is the public key bytes.
sub_script is the relevant portion of the locking script.
input_idx is the input being verified.
sighash_flag is the sighash type.
Returns Ok(true) if valid, Ok(false) if invalid, Err on failure.
Sourcefn tx_version(&self) -> u32
fn tx_version(&self) -> u32
Get the transaction version.
Sourcefn input_sequence(&self, input_idx: usize) -> u32
fn input_sequence(&self, input_idx: usize) -> u32
Get the sequence number of the given input.