Skip to content

Commit

Permalink
node: author the first block unconditionally
Browse files Browse the repository at this point in the history
This behavior is useful for testing. Specifically, for simple detection of
"healthyness" of the chain just after starting up.
  • Loading branch information
pepyakin committed Jan 11, 2024
1 parent ed6fb44 commit f8fdfdd
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion sugondat/chain/node/src/proposer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -83,8 +84,13 @@ impl<P: ProposerInterface<Block> + Send> ProposerInterface<Block> 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 healthyness.
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,
Expand Down

0 comments on commit f8fdfdd

Please sign in to comment.