Skip to content
Snippets Groups Projects
Commit 152bb308 authored by asynchronous rob's avatar asynchronous rob Committed by Gav Wood
Browse files

limit number of transactions when building blocks (#91)

parent ccb79c05
No related merge requests found
......@@ -628,6 +628,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,
......@@ -648,7 +650,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
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment