filter inventory advertisements correctly
This commit is contained in:
parent
3f150eb16e
commit
81a3ad3a0d
|
|
@ -401,9 +401,24 @@ where
|
||||||
// query rather than a newly gossiped block.
|
// query rather than a newly gossiped block.
|
||||||
//
|
//
|
||||||
// https://zebra.zfnd.org/dev/rfcs/0003-inventory-tracking.html#inventory-monitoring
|
// https://zebra.zfnd.org/dev/rfcs/0003-inventory-tracking.html#inventory-monitoring
|
||||||
if hashes.len() == 1 {
|
match hashes.as_slice() {
|
||||||
let hash = hashes[0];
|
[hash @ InventoryHash::Block(_)] => {
|
||||||
let _ = inv_collector.send((hash, addr));
|
let _ = inv_collector.send((*hash, addr));
|
||||||
|
}
|
||||||
|
[hashes @ ..]
|
||||||
|
if hashes
|
||||||
|
.iter()
|
||||||
|
.any(|&hash| matches!(hash, InventoryHash::Tx(_))) =>
|
||||||
|
{
|
||||||
|
for hash in hashes {
|
||||||
|
if matches!(hash, InventoryHash::Tx(_)) {
|
||||||
|
let _ = inv_collector.send((*hash, addr));
|
||||||
|
} else {
|
||||||
|
debug!(?hash, "ignored non Tx inventory hash")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ignored => debug!(?ignored, "ignored inventory advert"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
msg
|
msg
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue