Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
add bound
Browse files Browse the repository at this point in the history
  • Loading branch information
NikVolf committed May 7, 2020
1 parent 688329c commit df17087
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions client/network/src/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ const MAX_KNOWN_BLOCKS: usize = 1024; // ~32kb per peer + LruHashSet overhead
/// Maximim number of known extrinsic hashes to keep for a peer.
const MAX_KNOWN_EXTRINSICS: usize = 4096; // ~128kb per peer + overhead

/// Maximim number of transaction validation request we keep at any moment.
const MAX_PENDING_TRANSACTIONS: usize = 8192;

/// Current protocol version.
pub(crate) const CURRENT_VERSION: u32 = 6;
/// Lowest version we support
Expand Down Expand Up @@ -1151,6 +1154,15 @@ impl<B: BlockT, H: ExHashT> Protocol<B, H> {

self.peerset_handle.report_peer(who.clone(), rep::ANY_EXTRINSIC);

if self.pending_transactions.len() > MAX_PENDING_TRANSACTIONS {
debug!(
target: "sync",
"Ignoring any further transactions that exceed `MAX_PENDING_TRANSACTIONS`({}) limit",
MAX_PENDING_TRANSACTIONS,
);
break;
}

self.pending_transactions.push(PendingTransaction {
peer_id: who.clone(),
validation: self.transaction_pool.import(t),
Expand Down

0 comments on commit df17087

Please sign in to comment.