Skip to content

Commit f8fdfdd

Browse files
committed
node: author the first block unconditionally
This behavior is useful for testing. Specifically, for simple detection of "healthyness" of the chain just after starting up.
1 parent ed6fb44 commit f8fdfdd

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

sugondat/chain/node/src/proposer.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
//! non-inherent extrinsics and avoid authoring empty blocks.
66
//! 2. There is an incoming downward message from the relay chain.
77
//! 3. There is a go-ahead signal for a parachain code upgrade.
8+
//! 4. The block is the first block of the parachain. Useful for testing.
89
//!
910
//! If any of these conditions are met, then the block is authored.
1011
@@ -83,8 +84,13 @@ impl<P: ProposerInterface<Block> + Send> ProposerInterface<Block> for BlockLimit
8384
Ok(None) => false,
8485
}
8586
};
87+
let first_block = {
88+
// allow creating the first block without the above conditions. This is useful for
89+
// testing for detection of healthyness.
90+
parent_header.number == 0
91+
};
8692

87-
if has_downward_message || has_go_ahead || has_transactions {
93+
if has_downward_message || has_go_ahead || has_transactions || first_block {
8894
self.inner
8995
.propose(
9096
parent_header,

0 commit comments

Comments
 (0)