From a40395c0b75da9a4812608bf937c0ab8c3d34dde Mon Sep 17 00:00:00 2001 From: Sergei Shulepov Date: Thu, 11 Jan 2024 15:54:20 +0000 Subject: [PATCH] node: author the first block unconditionally This behavior is useful for testing. Specifically, for simple detection of "healthiness" of the chain just after starting up. --- sugondat/chain/node/src/proposer.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sugondat/chain/node/src/proposer.rs b/sugondat/chain/node/src/proposer.rs index f69271ab..1879cb3c 100644 --- a/sugondat/chain/node/src/proposer.rs +++ b/sugondat/chain/node/src/proposer.rs @@ -5,6 +5,7 @@ //! non-inherent extrinsics and avoid authoring empty blocks. //! 2. There is an incoming downward message from the relay chain. //! 3. There is a go-ahead signal for a parachain code upgrade. +//! 4. The block is the first block of the parachain. Useful for testing. //! //! If any of these conditions are met, then the block is authored. @@ -83,8 +84,13 @@ impl + Send> ProposerInterface for BlockLimit Ok(None) => false, } }; + let first_block = { + // allow creating the first block without the above conditions. This is useful for + // testing for detection of healthiness. + parent_header.number == 0 + }; - if has_downward_message || has_go_ahead || has_transactions { + if has_downward_message || has_go_ahead || has_transactions || first_block { self.inner .propose( parent_header,