diff --git a/consensus/src/lib.rs b/consensus/src/lib.rs index 2d4876db2072..e15aa77a3046 100644 --- a/consensus/src/lib.rs +++ b/consensus/src/lib.rs @@ -628,6 +628,8 @@ impl CreateProposal where use client::block_builder::BlockBuilder; use runtime_primitives::traits::{Hash as HashT, BlakeTwo256}; + const MAX_TRANSACTIONS: usize = 40; + let inherent_data = InherentData { timestamp: self.believed_minimum_timestamp, parachains: candidates, @@ -648,7 +650,7 @@ impl CreateProposal where let mut pending_size = 0; let ready_iter = self.transaction_pool.ready(); - for ready in ready_iter { + for ready in ready_iter.take(MAX_TRANSACTIONS) { let encoded_size = ready.data.encode().len(); if pending_size + encoded_size >= MAX_TRANSACTIONS_SIZE { break