Skip to content

Commit

Permalink
feat(rpc/trace): use matcher.matches
Browse files Browse the repository at this point in the history
Signed-off-by: jsvisa <delweng@gmail.com>
  • Loading branch information
jsvisa committed Jul 31, 2024
1 parent 4a1c147 commit 38bb1ea
Showing 1 changed file with 1 addition and 18 deletions.
19 changes: 1 addition & 18 deletions crates/rpc/rpc/src/trace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,24 +318,7 @@ where
// filter out traces that don't match the filter
all_traces = all_traces
.into_iter()
.filter(|trace| {
let trace = &trace.trace;
let (from_address, to_address) = match trace.action {
Action::Call(CallAction { from, to, .. }) => (Some(from), Some(to)),
Action::Create(CreateAction { from, .. }) => (
Some(from),
match trace.result {
Some(TraceOutput::Create(CreateOutput { address: to, .. })) => Some(to),
_ => None,
},
),
Action::Selfdestruct(SelfdestructAction {
address, refund_address, ..
}) => (Some(address), Some(refund_address)),
Action::Reward(RewardAction { author, .. }) => (None, Some(author)),
};
matcher.matches(from_address, to_address)
})
.filter(|trace| matcher.matches(&trace.trace))
.collect::<Vec<_>>();

// apply after and count to traces if specified, this allows for a pagination style.
Expand Down

0 comments on commit 38bb1ea

Please sign in to comment.