Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Simplify the Trace Filtering (#2751)
Browse files Browse the repository at this point in the history
  • Loading branch information
ngotchac committed Oct 20, 2016
1 parent 7d7b74a commit 2fbad39
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions ethcore/src/types/trace_types/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,27 +113,27 @@ impl Filter {

/// Returns true if given trace matches the filter.
pub fn matches(&self, trace: &FlatTrace) -> bool {
let action = match trace.action {
match trace.action {
Action::Call(ref call) => {
let from_matches = self.from_address.matches(&call.from);
let to_matches = self.to_address.matches(&call.to);
from_matches && to_matches
}
Action::Create(ref create) => {
let from_matches = self.from_address.matches(&create.from);
let to_matches = self.to_address.matches_all();

let to_matches = match trace.result {
Res::Create(ref create_result) => self.to_address.matches(&create_result.address),
_ => false
};

from_matches && to_matches
},
Action::Suicide(ref suicide) => {
let from_matches = self.from_address.matches(&suicide.address);
let to_matches = self.to_address.matches(&suicide.refund_address);
from_matches && to_matches
}
};

action || match trace.result {
Res::Create(ref create) => self.to_address.strictly_matches(&create.address),
_ => false
}
}
}
Expand Down

0 comments on commit 2fbad39

Please sign in to comment.