Skip to content

Commit

Permalink
Add err message to expects
Browse files Browse the repository at this point in the history
  • Loading branch information
njgheorghita committed Oct 30, 2023
1 parent 9ed3bbb commit d608081
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions portal-bridge/src/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,8 @@ impl From<Vec<Result<TraceGossipInfo, Error>>> for ContentStats {
match trace_gossip_info {
Ok(info) => {
for enr in info.offered.iter() {
let enr = Enr::from_str(enr).expect("");
let enr = Enr::from_str(enr)
.expect("ENR from trace gossip response to succesfully decode.");
// don't double count an enr if multiple clients offered the same content
// to a peer
if !content_stats.offered.contains(&enr) {
Expand All @@ -308,14 +309,16 @@ impl From<Vec<Result<TraceGossipInfo, Error>>> for ContentStats {
}

for enr in info.accepted.iter() {
let enr = Enr::from_str(enr).expect("");
let enr = Enr::from_str(enr)
.expect("ENR from trace gossip response to succesfully decode.");
if !content_stats.accepted.contains(&enr) {
content_stats.accepted.push(enr);
}
}

for enr in info.transferred.iter() {
let enr = Enr::from_str(enr).expect("");
let enr = Enr::from_str(enr)
.expect("ENR from trace gossip response to succesfully decode.");
if !content_stats.transferred.contains(&enr) {
content_stats.transferred.push(enr);
}
Expand Down

0 comments on commit d608081

Please sign in to comment.