Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: vinteumorg/Floresta
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: e749f78db266df0510fc2d73c073fb46e27361a5
Choose a base ref
..
head repository: vinteumorg/Floresta
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: cfb7c100a0553aa163ccf4a5d7cd43340ffcbf1b
Choose a head ref
Showing with 6 additions and 6 deletions.
  1. +6 −6 crates/floresta-compact-filters/src/lib.rs
12 changes: 6 additions & 6 deletions crates/floresta-compact-filters/src/lib.rs
Original file line number Diff line number Diff line change
@@ -113,7 +113,7 @@ impl BlockFilterBackend {
/// Creates a new [BlockFilterBackend].
///
/// Storage is a database used for storing and retrieving filters. May be anything
/// that implements [BlockFilterStore].
/// that implements [BlockFilterStore].
/// Key is a 256-bytes element that'll be used as key for the siphash iside our filters.
/// BIP-158 defines this key as the hash of each block, since they need a public parameter,
/// and a fixed one may be exploited by bad actors trying to trick a wallet into having many
@@ -161,7 +161,7 @@ impl BlockFilterBackend {
/// if at least one query mathes. It'll return a vector of block heights where it matches.
/// you should download those blocks and see what if there's anything interesting.
pub fn match_any(&self, start: u64, end: u64, query: &[QueryType]) -> Option<Vec<u64>> {
let mut values = query.into_iter().map(|filter| &*filter.into_slice());
let mut values = query.iter().map(|filter| filter.as_slice());

let mut blocks = Vec::new();

@@ -215,7 +215,7 @@ impl BlockFilterBackend {
}
fn write_outputs(&self, txs: &Vec<Transaction>, filter: &mut FilterBuilder) {
for tx in txs {
self.write_tx_outs(&tx, filter);
self.write_tx_outs(tx, filter);
}
}
}
@@ -330,7 +330,7 @@ pub enum QueryType {
}

impl QueryType {
pub(crate) fn into_slice(&self) -> &[u8] {
pub(crate) fn as_slice(&self) -> &[u8] {
match self {
QueryType::Txid(txid) => txid.as_inner().as_slice(),
QueryType::Input(outpoint) => &outpoint.0,
@@ -390,7 +390,7 @@ mod tests {
&mut [value].iter().copied(),
)
.unwrap();
assert_eq!(res, true);
assert!(res);

let value = [11_u8; 42].as_slice();
let res = filter
@@ -399,7 +399,7 @@ mod tests {
&mut [value].iter().copied(),
)
.unwrap();
assert_eq!(res, false);
assert!(!res);
}

#[test]