[−][src]Module bdk::blockchain::compact_filters
feature="compact_filters"
only.Compact Filters
This module contains a multithreaded implementation of an Blockchain
backend that
uses BIP157 (aka "Neutrino") to populate the wallet's database
by downloading compact filters from the P2P network.
Since there are currently very few peers "in the wild" that advertise the required service flag, this implementation requires that one or more known peers are provided by the user. No dns or other kinds of peer discovery are done internally.
Moreover, this module doesn't currently support detecting and resolving conflicts between messages received by different peers. Thus, it's recommended to use this module by only connecting to a single peer at a time, optionally by opening multiple connections if it's desirable to use multiple threads at once to sync in parallel.
Example
let num_threads = 4; let mempool = Arc::new(Mempool::default()); let peers = (0..num_threads) .map(|_| Peer::connect( "btcd-mainnet.lightning.computer:8333", Arc::clone(&mempool), Network::Bitcoin, )) .collect::<Result<_, _>>()?; let blockchain = CompactFiltersBlockchain::new(peers, "./wallet-filters", Some(500_000))?;
Structs
CompactFiltersBlockchain | feature="compact_filters" Structure implementing the required blockchain traits |
Mempool | feature="compact_filters" Container for unconfirmed, but valid Bitcoin transactions |
Peer | feature="compact_filters" A Bitcoin peer |
Enums
CompactFiltersError | feature="compact_filters" An error that can occur during sync with a |