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

Commit

Permalink
limit number of transactions when building blocks (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
rphmeier authored and gavofyork committed Jan 18, 2019
1 parent dde0b5e commit a35186d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion consensus/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,8 @@ impl<C, TxApi> CreateProposal<C, TxApi> 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,
Expand All @@ -665,7 +667,7 @@ impl<C, TxApi> CreateProposal<C, TxApi> 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
Expand Down

0 comments on commit a35186d

Please sign in to comment.