From 850ee8b43ab037df74e4e23bb8eecd089e9c7b54 Mon Sep 17 00:00:00 2001
From: arkpar <arkady.paronyan@gmail.com>
Date: Thu, 18 Jun 2020 10:43:03 +0200
Subject: [PATCH] Revert "Block packet size limit"

This reverts commit 08e0747d2b6b6f5353986af43a8b64c892cba3ae.
---
 substrate/client/network/src/protocol.rs      | 8 +-------
 substrate/client/network/src/protocol/sync.rs | 3 +--
 2 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/substrate/client/network/src/protocol.rs b/substrate/client/network/src/protocol.rs
index 6e08215050e..764c4164954 100644
--- a/substrate/client/network/src/protocol.rs
+++ b/substrate/client/network/src/protocol.rs
@@ -92,10 +92,6 @@ pub(crate) const MIN_VERSION: u32 = 3;
 
 // Maximum allowed entries in `BlockResponse`
 const MAX_BLOCK_DATA_RESPONSE: u32 = 128;
-// Maximum total bytes allowed for block bodies in `BlockResponse`
-// TODO: increase this to 4Mb once yamux limit is increased
-const MAX_BODIES_BYTES: usize = 1 * 1024 * 1024;
-
 /// When light node connects to the full node and the full node is behind light node
 /// for at least `LIGHT_MAXIMAL_BLOCKS_DIFFERENCE` blocks, we consider it not useful
 /// and disconnect to free connection slot.
@@ -766,9 +762,8 @@ impl<B: BlockT, H: ExHashT> Protocol<B, H> {
 		let get_justification = request
 			.fields
 			.contains(message::BlockAttributes::JUSTIFICATION);
-		let mut total_size = 0;
 		while let Some(header) = self.context_data.chain.header(id).unwrap_or(None) {
-			if blocks.len() >= max || total_size > MAX_BODIES_BYTES {
+			if blocks.len() >= max {
 				break;
 			}
 			let number = *header.number();
@@ -799,7 +794,6 @@ impl<B: BlockT, H: ExHashT> Protocol<B, H> {
 				trace!(target: "sync", "Missing data for block request.");
 				break;
 			}
-			total_size += block_data.body.as_ref().map_or(0, |b| b.len());
 			blocks.push(block_data);
 			match request.direction {
 				message::Direction::Ascending => id = BlockId::Number(number + One::one()),
diff --git a/substrate/client/network/src/protocol/sync.rs b/substrate/client/network/src/protocol/sync.rs
index 453d3f6f04e..781d410fff9 100644
--- a/substrate/client/network/src/protocol/sync.rs
+++ b/substrate/client/network/src/protocol/sync.rs
@@ -54,8 +54,7 @@ mod blocks;
 mod extra_requests;
 
 /// Maximum blocks to request in a single packet.
-/// TODO: set to 128 once yamux issue is resolved.
-const MAX_BLOCKS_TO_REQUEST: usize = 64;
+const MAX_BLOCKS_TO_REQUEST: usize = 128;
 
 /// Maximum blocks to store in the import queue.
 const MAX_IMPORTING_BLOCKS: usize = 2048;
-- 
GitLab