@@ -46,7 +46,6 @@ mod utils;
46
46
use crate :: poll:: { ChainTip , Poll , ValidatedBlockHeader } ;
47
47
48
48
use bitcoin:: blockdata:: block:: { Block , BlockHeader } ;
49
- use bitcoin:: blockdata:: transaction:: Transaction ;
50
49
use bitcoin:: hash_types:: BlockHash ;
51
50
use bitcoin:: util:: uint:: Uint256 ;
52
51
@@ -153,22 +152,18 @@ pub struct BlockHeaderData {
153
152
pub chainwork : Uint256 ,
154
153
}
155
154
156
- /// A block containing either all or only pertinent transactions .
155
+ /// A block including either all its transactions or only the block header .
157
156
///
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.
160
160
pub enum BlockData {
161
161
/// A block containing all its transactions.
162
162
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 ) ,
165
165
}
166
166
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
-
172
167
/// A lightweight client for keeping a listener in sync with the chain, allowing for Simplified
173
168
/// Payment Verification (SPV).
174
169
///
@@ -423,9 +418,8 @@ impl<'a, C: Cache, L: Deref> ChainNotifier<'a, C, L> where L::Target: chain::Lis
423
418
BlockData :: FullBlock ( block) => {
424
419
self . chain_listener . block_connected ( & block, height) ;
425
420
} ,
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) ;
429
423
} ,
430
424
}
431
425
0 commit comments