pub struct Emitter<C> { /* private fields */ }Expand description
The Emitter is used to emit data sourced from bitcoincore_rpc::Client.
Refer to module-level documentation for more.
Implementations§
Source§impl<C> Emitter<C>
impl<C> Emitter<C>
Sourcepub fn new(
client: C,
last_cp: CheckPoint,
start_height: u32,
expected_mempool_txs: impl IntoIterator<Item = impl Into<Arc<Transaction>>>,
) -> Self
pub fn new( client: C, last_cp: CheckPoint, start_height: u32, expected_mempool_txs: impl IntoIterator<Item = impl Into<Arc<Transaction>>>, ) -> Self
Construct a new Emitter.
last_cp informs the emitter of the chain we are starting off with. This way, the emitter
can start emission from a block that connects to the original chain.
start_height starts emission from a given height (if there are no conflicts with the
original chain).
expected_mempool_txs is the initial set of unconfirmed transactions provided by the
wallet. This allows the Emitter to inform the wallet about relevant mempool evictions.
If it is known that the wallet is empty, NO_EXPECTED_MEMPOOL_TXS can be used.
Sourcepub fn mempool(&mut self) -> Result<MempoolEvent, Error>
pub fn mempool(&mut self) -> Result<MempoolEvent, Error>
Emit mempool transactions and any evicted Txids.
This method returns a MempoolEvent containing the full transactions (with their
first-seen unix timestamps) that were emitted, and MempoolEvent::evicted which are
any Txids which were previously seen in the mempool and are now missing. Evicted txids
are only reported once the emitter’s checkpoint matches the RPC’s best block in both height
and hash. Until next_block() advances the checkpoint to tip, mempool() will always
return an empty evicted set.
Sourcepub fn mempool_at(&mut self, sync_time: u64) -> Result<MempoolEvent, Error>
pub fn mempool_at(&mut self, sync_time: u64) -> Result<MempoolEvent, Error>
Sourcepub fn next_block(&mut self) -> Result<Option<BlockEvent<Block>>, Error>
pub fn next_block(&mut self) -> Result<Option<BlockEvent<Block>>, Error>
Emit the next block height and block (if any).