Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions consensus/safety-rules/src/safety_rules_2chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ impl SafetyRules {
let block1 = proposed_block.round();
let block0 = proposed_block.quorum_cert().certified_block().round();

// verify 2-chain rule
let commit = next_round(block0)? == block1;
// verify 2-chain rule, no commit on genesis block (round 0)
let commit = next_round(block0)? == block1 && block0 > 0;

// create a ledger info
let commit_info = if commit {
Expand Down
6 changes: 4 additions & 2 deletions consensus/safety-rules/src/tests/suite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -701,8 +701,10 @@ fn test_2chain_rules(constructor: &Callback) {
result.unwrap_err();
}
};
// block == qc + 1, commit
expect(&a1, None, true, true);

// block == qc + 1, but no commit because qc points to genesis (round 0)
expect(&a1, None, true, false);

// block != qc + 1 && block != tc + 1
expect(
&b1,
Expand Down
Loading