From 277da611dd03bc181b094682acf83138e2ea85aa Mon Sep 17 00:00:00 2001 From: librelois Date: Fri, 21 Jan 2022 01:46:25 +0100 Subject: [PATCH] fix: manual seal can't produce non-empty blocks in BABE runtimes --- client/consensus/manual-seal/src/seal_block.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/client/consensus/manual-seal/src/seal_block.rs b/client/consensus/manual-seal/src/seal_block.rs index 502705b411621..a1274b81b0d47 100644 --- a/client/consensus/manual-seal/src/seal_block.rs +++ b/client/consensus/manual-seal/src/seal_block.rs @@ -136,8 +136,12 @@ pub async fn seal_block( .map_err(|err| Error::StringError(format!("{:?}", err))) .await?; - if proposal.block.extrinsics().len() == inherents_len && !create_empty { - return Err(Error::EmptyTransactionPool) + // README: we need to hack this control to be able to create non-empty blocks in manual mode with BABE runtime + // This is due to the fact that BABE creates 2 digests (PreRuntime and Seal), while manual seal creates only one (Preruntime). + // So if we try to create a block containing only 1 user extrinsic (which we do all the time in our integration tests), this control + // returns an error and prevents our integration tests from working. + if proposal.block.extrinsics().len() < inherents_len && !create_empty { + return Err(Error::StringError("proposal.block.extrinsics().len() < inherents_len".to_owned())) } let (header, body) = proposal.block.deconstruct();