Merge pull request #606 from romanz/fix-bip158-format

Fix bip158 example formatting
This commit is contained in:
Dr. Maxim Orlovsky 2021-06-06 20:11:22 +02:00 committed by GitHub
commit 73f1ed7d4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 18 deletions

View File

@ -23,25 +23,26 @@
//! 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)
//! ## Example
//!
//! fn get_script_for_coin (coin: &OutPoint) -> Result<Script, BlockFilterError> {
//! // get utxo ...
//! }
//! ```ignore
//! fn get_script_for_coin(coin: &OutPoint) -> Result<Script, BlockFilterError> {
//! // get utxo ...
//! }
//!
//! let filter = BlockFilter::new_script_filter (&block, get_script_for_coin)?;
//! // 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);
//! // 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
//! }
//! // 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};