pub fn new<P: AsRef<Path>>(
        peers: Vec<Peer>,
        storage_dir: P,
        skip_blocks: Option<usize>,
    ) -> Result<Self, CompactFiltersError> {
        if peers.is_empty() {
            return Err(CompactFiltersError::NoPeers);
        }

        let mut opts = Options::default();
        opts.create_if_missing(true);
        opts.set_prefix_extractor(SliceTransform::create_fixed_prefix(16));

        let network = peers[0].get_network();

        let cfs = DB::list_cf(&opts, &storage_dir).unwrap_or_else(|_| vec!["default".to_string()]);
        let db = DB::open_cf(&opts, &storage_dir, &cfs)?;
        let headers = Arc::new(ChainStore::new(db, network)?);

        // try to recover partial snapshots
        for cf_name in &cfs {
            if !cf_name.starts_with("_headers:") {
                continue;
            }

            info!("Trying to recover: {:?}", cf_name);
            headers.recover_snapshot(cf_name)?;
        }

        Ok(CompactFiltersBlockchain {
            peers: peers.into_iter().map(Arc::new).collect(),
            headers,
            skip_blocks,
        })
    }
/// Construct a new instance given a list of peers, a path to store headers and block
/// filters downloaded during the sync and optionally a number of blocks to ignore starting
/// from the genesis while scanning for the wallet's outputs.
///
/// For each [`Peer`] specified a new thread will be spawned to download and verify the filters
/// in parallel. It's currently recommended to only connect to a single peer to avoid
/// inconsistencies in the data returned, optionally with multiple connections in parallel to
/// speed-up the sync process.
Construct a new instance given a list of peers, a path to store headers and block
filters downloaded during the sync and optionally a number of blocks to ignore starting
from the genesis while scanning for the wallet's outputs.

For each [`Peer`] specified a new thread will be spawned to download and verify the filters
in parallel. It's currently recommended to only connect to a single peer to avoid
inconsistencies in the data returned, optionally with multiple connections in parallel to
speed-up the sync process.
Construct a new instance given a list of peers a path to store headers and block filters downloaded during the sync and optionally a number of blocks to ignore starting from the genesis while scanning for the wallet ' s outputs . For each [ ` Peer ` ] specified a new thread will be spawned to download and verify the filters in parallel . It ' s currently recommended to only connect to a single peer to avoid inconsistencies in the data returned optionally with multiple connections in parallel to speed - up the sync process .
pub fn new<P: AsRef<Path>>(
        peers: Vec<Peer>,
        storage_dir: P,
        skip_blocks: Option<usize>,
    ) -> Result<Self, CompactFiltersError> {
        if peers.is_empty() {
            return Err(CompactFiltersError::NoPeers);
        }
        let mut opts = Options::default();
        opts.create_if_missing(true);
        opts.set_prefix_extractor(SliceTransform::create_fixed_prefix(16));
        let network = peers[0].get_network();
        let cfs = DB::list_cf(&opts, &storage_dir).unwrap_or_else(|_| vec!["default".to_string()]);
        let db = DB::open_cf(&opts, &storage_dir, &cfs)?;
        let headers = Arc::new(ChainStore::new(db, network)?);
        // try to recover partial snapshots
        for cf_name in &cfs {
            if !cf_name.starts_with("_headers:") {
                continue;
            }
            info!("Trying to recover: {:?}", cf_name);
            headers.recover_snapshot(cf_name)?;
        }
        Ok(CompactFiltersBlockchain {
            peers: peers.into_iter().map(Arc::new).collect(),
            headers,
            skip_blocks,
        })
    }
pub fn new < P : AsRef < Path > > ( peers : Vec < Peer > , storage_dir : P , skip_blocks : Option < usize > , ) -> Result < Self , CompactFiltersError > { if peers . is_empty ( ) { return Err ( CompactFiltersError :: NoPeers ) ; } let mut opts = Options :: default ( ) ; opts . create_if_missing ( true ) ; opts . set_prefix_extractor ( SliceTransform :: create_fixed_prefix ( 16 ) ) ; let network = peers [ 0 ] . get_network ( ) ; let cfs = DB :: list_cf ( & opts , & storage_dir ) . unwrap_or_else ( | _ | vec ! [ " " to_string ( ) ] ) ; let db = DB :: open_cf ( & opts , & storage_dir , & cfs ) ? ; let headers = Arc :: new ( ChainStore :: new ( db , network ) ? ) ; // try to recover partial snapshots for cf_name in & cfs { if ! cf_name . starts_with ( " " ) { continue ; } info ! ( " " cf_name ) ; headers . recover_snapshot ( cf_name ) ? ; } Ok ( CompactFiltersBlockchain { peers : peers . into_iter ( ) . map ( Arc :: new ) . collect ( ) , headers , skip_blocks , } ) }
Construct a new instance given a list of peers, a path to store headers and block
filters downloaded during the sync and optionally a number of blocks to ignore starting
from the genesis while scanning for the wallet's outputs.
Construct a new instance given a list of peers a path to store headers and block filters downloaded during the sync and optionally a number of blocks to ignore starting from the genesis while scanning for the wallet ' s outputs .
peers
Vec<Peer>
storage_dir
P
skip_blocks
Option<usize>
peers
Vec<Peer>
storage_dir
P
skip_blocks
Option<usize>