1- //! This crate is used for emitting blockchain data from the `bitcoind` RPC interface (excluding the  
2- //! RPC  wallet API) . 
1+ //! This crate is used for emitting blockchain data from the `bitcoind` RPC interface. It does not  
2+ //! use the  wallet RPC  API, so this crate can be used with wallet-disabled Bitcoin Core nodes . 
33//! 
44//! [`Emitter`] is the main structure which sources blockchain data from [`bitcoincore_rpc::Client`]. 
55//! 
@@ -23,7 +23,14 @@ pub struct Emitter<'c, C> {
2323    client :  & ' c  C , 
2424    start_height :  u32 , 
2525
26+     /// The checkpoint of the last-emitted block that is in the best chain. If it is later found 
27+      /// that the block is no longer in the best chain, it will be popped off from here. 
2628     last_cp :  Option < CheckPoint > , 
29+ 
30+     /// The block result returned from rpc of the last-emitted block. As this result contains the 
31+      /// next block's block hash (which we use to fetch the next block), we set this to `None` 
32+      /// whenever there are no more blocks, or the next block is no longer in the best chain. This 
33+      /// gives us an opportunity to re-fetch this result. 
2734     last_block :  Option < bitcoincore_rpc_json:: GetBlockResult > , 
2835
2936    /// The latest first-seen epoch of emitted mempool transactions. This is used to determine 
@@ -67,15 +74,14 @@ impl<'c, C: bitcoincore_rpc::RpcApi> Emitter<'c, C> {
6774
6875    /// Emit mempool transactions, alongside their first-seen unix timestamps. 
6976     /// 
70-      /// Ideally, this method would only emit the same transaction once. However, if the receiver 
71-      /// filters transactions based on whether it alters the output set of tracked script pubkeys, 
72-      /// there are situations where we would want to re-emit. For example, if an emitted mempool 
73-      /// transaction spends a tracked UTXO which is confirmed at height `h`, but the receiver has 
74-      /// only seen up to block of height `h-1`, we want to re-emit this transaction until the 
75-      /// receiver has seen the block at height `h`. 
77+      /// This method emits each transaction only once, unless we cannot guarantee the transaction's 
78+      /// ancestors are already emitted. 
7679     /// 
77-      /// In other words, we want to re-emit a transaction if we cannot guarantee it's ancestors are 
78-      /// already emitted. 
80+      /// To understand why, consider a receiver which filters transactions based on whether it 
81+      /// alters the UTXO set of tracked script pubkeys. If an emitted mempool transaction spends a 
82+      /// tracked UTXO which is confirmed at height `h`, but the receiver has only seen up to block 
83+      /// of height `h-1`, we want to re-emit this transaction until the receiver has seen the block 
84+      /// at height `h`. 
7985     pub  fn  mempool ( & mut  self )  -> Result < Vec < ( Transaction ,  u64 ) > ,  bitcoincore_rpc:: Error >  { 
8086        let  client = self . client ; 
8187
0 commit comments