From 4cdbc30ee46738c770a9e0f7a750eb46f02b4a07 Mon Sep 17 00:00:00 2001 From: Tirth Patel Date: Tue, 28 Feb 2023 03:06:51 +0100 Subject: [PATCH] Add soft limit --- crates/net/network/src/transactions.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/crates/net/network/src/transactions.rs b/crates/net/network/src/transactions.rs index 3b470781365..7eefb22ec60 100644 --- a/crates/net/network/src/transactions.rs +++ b/crates/net/network/src/transactions.rs @@ -547,12 +547,19 @@ enum PooledTransactionsHashesBuilder { impl PooledTransactionsHashesBuilder { fn push(&mut self, tx: &PropagateTransaction) { + let soft_limit = 4096; match self { - PooledTransactionsHashesBuilder::Eth66(msg) => msg.0.push(tx.hash()), + PooledTransactionsHashesBuilder::Eth66(msg) => { + if msg.0.len() <= soft_limit { + msg.0.push(tx.hash()); + } + }, PooledTransactionsHashesBuilder::Eth68(msg) => { - msg.hashes.push(tx.hash()); - msg.sizes.push(tx.length); - msg.types.push(tx.tx_type); + if msg.hashes.len() <= soft_limit { + msg.hashes.push(tx.hash()); + msg.sizes.push(tx.length); + msg.types.push(tx.tx_type); + } } } }