@@ -46,7 +46,6 @@ mod utils;
4646use crate :: poll:: { ChainTip , Poll , ValidatedBlockHeader } ;
4747
4848use bitcoin:: blockdata:: block:: { Block , BlockHeader } ;
49- use bitcoin:: blockdata:: transaction:: Transaction ;
5049use bitcoin:: hash_types:: BlockHash ;
5150use bitcoin:: util:: uint:: Uint256 ;
5251
@@ -153,22 +152,18 @@ pub struct BlockHeaderData {
153152 pub chainwork : Uint256 ,
154153}
155154
156- /// A block containing either all or only pertinent transactions .
155+ /// A block including either all its transactions or only the block header .
157156///
158- /// See [`chain::Filter`] for when a [`BlockSource`] should be implemented to filter only pertinent
159- /// transactions.
157+ /// [`BlockSource`] may be implemented to either always return full blocks or, in the case of
158+ /// compact block filters (BIP 157/158), return header-only blocks when no pertinent transactions
159+ /// match. See [`chain::Filter`] for details on how to notify a source of such transactions.
160160pub enum BlockData {
161161 /// A block containing all its transactions.
162162 FullBlock ( Block ) ,
163- /// A block that has been filtered for only pertinent transactions.
164- FilteredBlock ( BlockHeader , OwnedTransactionData ) ,
163+ /// A block header for when the block does not contain any pertinent transactions.
164+ HeaderOnly ( BlockHeader ) ,
165165}
166166
167- /// Similar to [`TransactionData`] only for [`Transaction`] data owned outside of a block.
168- ///
169- /// [`TransactionData`]: chain::transaction::TransactionData
170- pub type OwnedTransactionData = Vec < ( usize , Transaction ) > ;
171-
172167/// A lightweight client for keeping a listener in sync with the chain, allowing for Simplified
173168/// Payment Verification (SPV).
174169///
@@ -423,9 +418,8 @@ impl<'a, C: Cache, L: Deref> ChainNotifier<'a, C, L> where L::Target: chain::Lis
423418 BlockData :: FullBlock ( block) => {
424419 self . chain_listener . block_connected ( & block, height) ;
425420 } ,
426- BlockData :: FilteredBlock ( header, txdata) => {
427- let txdata: Vec < _ > = txdata. iter ( ) . map ( |( idx, tx) | ( * idx, tx) ) . collect ( ) ;
428- self . chain_listener . filtered_block_connected ( & header, & txdata, height) ;
421+ BlockData :: HeaderOnly ( header) => {
422+ self . chain_listener . filtered_block_connected ( & header, & [ ] , height) ;
429423 } ,
430424 }
431425
0 commit comments