Fix gossip messages growing beyond blob size (#5460)
* fixed bloom filter math * Add split each pull request into multiple pulls with different filters * Rework CrdsFilter to generate all possible masks to cover the keyspace * Limit the bloom sizes such that each pull request is no larger than mtu
This commit is contained in:
@@ -335,7 +335,9 @@ pub fn to_blob<T: Serialize>(resp: T, rsp_addr: SocketAddr) -> Result<Blob> {
|
||||
let mut b = Blob::default();
|
||||
let v = bincode::serialize(&resp)?;
|
||||
let len = v.len();
|
||||
assert!(len <= BLOB_SIZE);
|
||||
if len > BLOB_SIZE {
|
||||
return Err(Error::ToBlobError);
|
||||
}
|
||||
b.data[..len].copy_from_slice(&v);
|
||||
b.meta.size = len;
|
||||
b.meta.set_addr(&rsp_addr);
|
||||
|
Reference in New Issue
Block a user