feat(bip158): compute canonical filter hash

This commit is contained in:
Rob N 2024-08-22 10:33:14 -10:00
parent 722a7239df
commit 96e0e720fd
No known key found for this signature in database
GPG Key ID: F4DD8F8486EC0F1F
1 changed files with 6 additions and 0 deletions

View File

@ -149,6 +149,12 @@ impl BlockFilter {
FilterHash(sha256d::Hash::hash(&self.content)).filter_header(previous_filter_header)
}
/// Computes the canonical hash for the given filter.
pub fn filter_hash(&self) -> FilterHash {
let hash = sha256d::Hash::hash(&self.content);
FilterHash(hash)
}
/// Returns true if any query matches against this [`BlockFilter`].
pub fn match_any<I>(&self, block_hash: BlockHash, query: I) -> Result<bool, Error>
where