Trace filtering fix (#2760)

* (#2751) Trace filtering fix:
  Don't test contract address against empty array in trace filtering

* Fixes spaces/typo

* Simplify the Trace Filtering (#2751)

* Removed unused `strictly_matches` fn
This commit is contained in:
Nicolas Gotchac 2016-10-20 22:35:56 +01:00 committed by Gav Wood
parent 7efffea34b
commit 236fb82886

View File

@ -108,7 +108,7 @@ 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);
@ -116,7 +116,12 @@ impl Filter {
}
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) => {
@ -124,11 +129,6 @@ impl Filter {
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.matches(&create.address),
_ => false
}
}
}