@@ -250,16 +250,12 @@ impl DetailedSyncProgress {
250250///
251251/// ## Memory Considerations
252252/// - headers: ~80 bytes per header
253- /// - filter_headers: 32 bytes per filter header
254- /// - At 2M blocks: ~160MB for headers, ~64MB for filter headers
253+ /// - At 2M blocks: ~160MB for headers
255254#[ derive( Clone , Default ) ]
256255pub struct ChainState {
257256 /// Block headers indexed by height.
258257 pub headers : Vec < BlockHeader > ,
259258
260- /// Filter headers indexed by height.
261- pub filter_headers : Vec < FilterHeader > ,
262-
263259 /// Last ChainLock height.
264260 pub last_chainlock_height : Option < u32 > ,
265261
@@ -355,28 +351,11 @@ impl ChainState {
355351 self . headers . get ( index)
356352 }
357353
358- /// Get filter header at the given height.
359- pub fn filter_header_at_height ( & self , height : u32 ) -> Option < & FilterHeader > {
360- if height < self . sync_base_height {
361- return None ; // Height is before our sync base
362- }
363- let index = ( height - self . sync_base_height ) as usize ;
364- self . filter_headers . get ( index)
365- }
366-
367354 /// Add headers to the chain.
368355 pub fn add_headers ( & mut self , headers : Vec < BlockHeader > ) {
369356 self . headers . extend ( headers) ;
370357 }
371358
372- /// Add filter headers to the chain.
373- pub fn add_filter_headers ( & mut self , filter_headers : Vec < FilterHeader > ) {
374- if let Some ( last) = filter_headers. last ( ) {
375- self . current_filter_tip = Some ( * last) ;
376- }
377- self . filter_headers . extend ( filter_headers) ;
378- }
379-
380359 /// Get the tip header
381360 pub fn get_tip_header ( & self ) -> Option < BlockHeader > {
382361 self . headers . last ( ) . copied ( )
@@ -458,7 +437,6 @@ impl ChainState {
458437 ) {
459438 // Clear any existing headers
460439 self . headers . clear ( ) ;
461- self . filter_headers . clear ( ) ;
462440
463441 // Set sync base height to checkpoint
464442 self . sync_base_height = checkpoint_height;
@@ -498,7 +476,6 @@ impl std::fmt::Debug for ChainState {
498476 fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
499477 f. debug_struct ( "ChainState" )
500478 . field ( "headers" , & format ! ( "{} headers" , self . headers. len( ) ) )
501- . field ( "filter_headers" , & format ! ( "{} filter headers" , self . filter_headers. len( ) ) )
502479 . field ( "last_chainlock_height" , & self . last_chainlock_height )
503480 . field ( "last_chainlock_hash" , & self . last_chainlock_hash )
504481 . field ( "current_filter_tip" , & self . current_filter_tip )
0 commit comments