Skip to content

Commit

Permalink
Merge pull request #606 from romanz/fix-bip158-format
Browse files Browse the repository at this point in the history
Fix bip158 example formatting
  • Loading branch information
dr-orlovsky committed Jun 6, 2021
2 parents d7eb15c + 60e51ad commit 73f1ed7
Showing 1 changed file with 19 additions and 18 deletions.
37 changes: 19 additions & 18 deletions src/util/bip158.rs
Expand Up @@ -23,26 +23,27 @@
//! The filter construction proposed is an alternative to Bloom filters, as used in BIP 37,
//! that minimizes filter size by using Golomb-Rice coding for compression.
//!
//! USE :
//! // create a block filter for a block (server side)
//!
//! fn get_script_for_coin (coin: &OutPoint) -> Result<Script, BlockFilterError> {
//! // get utxo ...
//! }
//!
//! let filter = BlockFilter::new_script_filter (&block, get_script_for_coin)?;
//!
//! // or create a filter from known raw data
//! let filter = BlockFilter::new(content);
//!
//! // read and evaluate a filter
//!
//! let query: Iterator<Item=Script> = // .. some scripts you care about
//! if filter.match_any (&block_hash, &mut query.map(|s| s.as_bytes())) {
//! // get this block
//! }
//! ## Example
//!
//! ```ignore
//! fn get_script_for_coin(coin: &OutPoint) -> Result<Script, BlockFilterError> {
//! // get utxo ...
//! }
//!
//! // create a block filter for a block (server side)
//! let filter = BlockFilter::new_script_filter(&block, get_script_for_coin)?;
//!
//! // or create a filter from known raw data
//! let filter = BlockFilter::new(content);
//!
//! // read and evaluate a filter
//!
//! let query: Iterator<Item=Script> = // .. some scripts you care about
//! if filter.match_any(&block_hash, &mut query.map(|s| s.as_bytes())) {
//! // get this block
//! }
//! ```
//!

use std::{cmp, fmt, io};
use std::collections::HashSet;
Expand Down

0 comments on commit 73f1ed7

Please sign in to comment.