bdk_chain::indexer

Trait 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§