@@ -14,10 +14,9 @@ use super::{
1414 CFHeaderBatch , CFHeaderChanges , ChainState , Filter , FilterCheck , FilterHeaderRequest ,
1515 FilterRequest , FilterRequestState , HeaderValidationExt , HeightMonitor , PeerId ,
1616} ;
17- use crate :: IndexedFilter ;
1817use crate :: { chain:: BlockHeaderChanges , messages:: Event , Dialog , Info , Progress } ;
18+ use crate :: { FilterType , IndexedFilter } ;
1919
20- const FILTER_BASIC : u8 = 0x00 ;
2120const CF_HEADER_BATCH_SIZE : u32 = 1_999 ;
2221const FILTER_BATCH_SIZE : u32 = 999 ;
2322
@@ -28,6 +27,7 @@ pub(crate) struct Chain {
2827 network : Network ,
2928 heights : Arc < Mutex < HeightMonitor > > ,
3029 dialog : Arc < Dialog > ,
30+ filter_type : FilterType ,
3131}
3232
3333impl Chain {
@@ -37,6 +37,7 @@ impl Chain {
3737 dialog : Arc < Dialog > ,
3838 height_monitor : Arc < Mutex < HeightMonitor > > ,
3939 quorum_required : u8 ,
40+ filter_type : FilterType ,
4041 ) -> Self {
4142 let header_chain = match chain_state {
4243 ChainState :: Snapshot ( headers) => {
@@ -60,6 +61,7 @@ impl Chain {
6061 network,
6162 heights : height_monitor,
6263 dialog,
64+ filter_type,
6365 }
6466 }
6567
@@ -295,7 +297,7 @@ impl Chain {
295297 stop_hash,
296298 } ) ;
297299 GetCFHeaders {
298- filter_type : FILTER_BASIC ,
300+ filter_type : self . filter_type . into ( ) ,
299301 start_height : last_unchecked_cfheader,
300302 stop_hash,
301303 }
@@ -372,7 +374,7 @@ impl Chain {
372374 start_height : last_unchecked_filter,
373375 } ) ;
374376 GetCFilters {
375- filter_type : FILTER_BASIC ,
377+ filter_type : self . filter_type . into ( ) ,
376378 start_height : last_unchecked_filter,
377379 stop_hash,
378380 }
@@ -437,6 +439,7 @@ mod tests {
437439 use tokio:: sync:: Mutex ;
438440
439441 use crate :: chain:: ChainState ;
442+ use crate :: FilterType ;
440443 use crate :: {
441444 chain:: checkpoints:: HeaderCheckpoint ,
442445 messages:: { Event , Info , Warning } ,
@@ -459,6 +462,7 @@ mod tests {
459462 Arc :: new ( Dialog :: new ( info_tx, warn_tx, event_tx) ) ,
460463 height_monitor,
461464 peers,
465+ FilterType :: Basic ,
462466 )
463467 }
464468
0 commit comments