improve logging

This commit is contained in:
Jane Lusby 2020-09-08 11:05:12 -07:00 committed by Henry de Valence
parent 81a3ad3a0d
commit 1b17691dda
1 changed files with 5 additions and 7 deletions

View File

@ -394,6 +394,7 @@ where
})
.then(move |msg| {
let inv_collector = inv_collector.clone();
let span = debug_span!("inventory_filter");
async move {
if let Ok(Message::Inv(hashes)) = &msg {
// We ignore inventory messages with more than one
@ -405,24 +406,21 @@ where
[hash @ InventoryHash::Block(_)] => {
let _ = inv_collector.send((*hash, addr));
}
[hashes @ ..]
if hashes
.iter()
.any(|&hash| matches!(hash, InventoryHash::Tx(_))) =>
{
[hashes @ ..] => {
for hash in hashes {
if matches!(hash, InventoryHash::Tx(_)) {
debug!(?hash, "registering Tx inventory hash");
let _ = inv_collector.send((*hash, addr));
} else {
debug!(?hash, "ignored non Tx inventory hash")
trace!(?hash, "ignoring non Tx inventory hash")
}
}
}
ignored => debug!(?ignored, "ignored inventory advert"),
}
}
msg
}
.instrument(span)
})
.boxed();