Trait bdk_chain::indexer::Indexer

source ·
pub trait Indexer {
    type ChangeSet;

    // Required methods
    fn index_txout(
        &mut self,
        outpoint: OutPoint,
        txout: &TxOut
    ) -> Self::ChangeSet;
    fn index_tx(&mut self, tx: &Transaction) -> Self::ChangeSet;
    fn apply_changeset(&mut self, changeset: Self::ChangeSet);
    fn initial_changeset(&self) -> Self::ChangeSet;
    fn is_tx_relevant(&self, tx: &Transaction) -> bool;
}
Expand description

Utilities for indexing transaction data.

Types which implement this trait can be used to construct an IndexedTxGraph. This trait’s methods should rarely be called directly.

Required Associated Types§

source

type ChangeSet

The resultant “changeset” when new transaction data is indexed.

Required Methods§

source

fn index_txout(&mut self, outpoint: OutPoint, txout: &TxOut) -> Self::ChangeSet

Scan and index the given outpoint and txout.

source

fn index_tx(&mut self, tx: &Transaction) -> Self::ChangeSet

Scans a transaction for relevant outpoints, which are stored and indexed internally.

source

fn apply_changeset(&mut self, changeset: Self::ChangeSet)

Apply changeset to itself.

source

fn initial_changeset(&self) -> Self::ChangeSet

Determines the ChangeSet between self and an empty Indexer.

source

fn is_tx_relevant(&self, tx: &Transaction) -> bool

Determines whether the transaction should be included in the index.

Implementors§