Skip to content

Commit

Permalink
fix: manual seal can't produce non-empty blocks in BABE runtimes
Browse files Browse the repository at this point in the history
  • Loading branch information
librelois committed Feb 5, 2022
1 parent 2c45496 commit 1d2fe38
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions client/consensus/manual-seal/src/seal_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,12 @@ pub async fn seal_block<B, BI, SC, C, E, TP, CIDP>(
.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();
Expand Down

0 comments on commit 1d2fe38

Please sign in to comment.