Skip to main content

TransactionContext

Trait TransactionContext 

Source
pub trait TransactionContext {
    type Input: TransactionInputContext;
    type Output: TransactionOutputContext;

    // Required methods
    fn version(&self) -> i32;
    fn inputs(&self) -> &[Self::Input];
    fn outputs(&self) -> &[Self::Output];
    fn lock_time(&self) -> u32;

    // Provided methods
    fn input(&self, index: usize) -> Option<&Self::Input> { ... }
    fn output(&self, index: usize) -> Option<&Self::Output> { ... }
    fn input_count(&self) -> usize { ... }
    fn output_count(&self) -> usize { ... }
}
Expand description

Full transaction context for script validation.

This trait provides all the data needed by the Spend validator to validate a transaction input. The Transaction module will implement this trait.

Required Associated Types§

Source

type Input: TransactionInputContext

The input type implementing TransactionInputContext.

Source

type Output: TransactionOutputContext

The output type implementing TransactionOutputContext.

Required Methods§

Source

fn version(&self) -> i32

Transaction version.

Source

fn inputs(&self) -> &[Self::Input]

All inputs in this transaction.

Source

fn outputs(&self) -> &[Self::Output]

All outputs in this transaction.

Source

fn lock_time(&self) -> u32

The lock time.

Provided Methods§

Source

fn input(&self, index: usize) -> Option<&Self::Input>

Get a specific input by index.

Source

fn output(&self, index: usize) -> Option<&Self::Output>

Get a specific output by index.

Source

fn input_count(&self) -> usize

Number of inputs.

Source

fn output_count(&self) -> usize

Number of outputs.

Implementors§