Skip to content

Commit

Permalink
Fix topic wildcards bug (#277)
Browse files Browse the repository at this point in the history
  • Loading branch information
tgmichel authored Jan 29, 2021
1 parent 761083c commit 6a6e3f5
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions client/rpc-core/src/types/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,18 @@ impl FilteredParams {
}
}
},
VariadicValue::Multiple(_) => {
let replaced: Option<Vec<H256>> = self.replace(log, topic);
VariadicValue::Multiple(multi) => {
// Shrink the topics until the last item is Some.
let mut new_multi = multi;
while new_multi.iter().last().unwrap_or(&Some(H256::default())).is_none() {
new_multi.pop();
}
// We can discard right away any logs with lesser topics than the filter.
if new_multi.len() > log.topics.len() {
out = false;
break;
}
let replaced: Option<Vec<H256>> = self.replace(log, VariadicValue::Multiple(new_multi));
if let Some(replaced) = replaced {
out = false;
if log.topics.starts_with(
Expand Down

0 comments on commit 6a6e3f5

Please sign in to comment.