Trait BlockConsumer

Source
pub trait BlockConsumer:
    Sync
    + Send
    + 'static {
    // Required methods
    fn wants_spent_utxos(&self) -> bool;
    fn on_block(
        &self,
        block: &Block,
        height: u32,
        spent_utxos: Option<&HashMap<OutPoint, UtxoData>>,
    );
}
Expand description

Trait for components that need to receive notifications about new blocks.

Required Methods§

Source

fn wants_spent_utxos(&self) -> bool

Return true if this consumer wants the set of spent UTXOs.

Source

fn on_block( &self, block: &Block, height: u32, spent_utxos: Option<&HashMap<OutPoint, UtxoData>>, )

Called whenever a valid block is connected. spent_utxos is None unless consumer wants_spent_utxos().

Implementations on Foreign Types§

Source§

impl BlockConsumer for Channel<(Block, u32)>

Source§

fn wants_spent_utxos(&self) -> bool

Source§

fn on_block( &self, block: &Block, height: u32, _spent_utxos: Option<&HashMap<OutPoint, UtxoData>>, )

Source§

impl BlockConsumer for Channel<(Block, u32, HashMap<OutPoint, UtxoData>)>

Source§

fn wants_spent_utxos(&self) -> bool

Source§

fn on_block( &self, block: &Block, height: u32, spent_utxos: Option<&HashMap<OutPoint, UtxoData>>, )

Implementors§