mirror of
https://github.com/tendermint/tendermint.git
synced 2026-08-19 13:46:17 +00:00
fix require condition to be correct
This commit is contained in:
@@ -2764,7 +2764,7 @@ func (cs *State) calculateProposalTimestampDifferenceMetric() {
|
||||
|
||||
func (cs *State) requireVoteExtension() bool {
|
||||
requireHeight := cs.state.ConsensusParams.Vote.ExtensionRequireHeight
|
||||
if requireHeight < cs.Height {
|
||||
if requireHeight == 0 || cs.Height < requireHeight {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
|
||||
@@ -2260,6 +2260,9 @@ func TestPrepareProposalReceivesVoteExtensions(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestVoteExtensionRequiredHeight tests that 'ExtensionRequireHeight' correctly
|
||||
// enforces that vote extensions be present in consensus for heights greater than
|
||||
// or equal to the configured value.
|
||||
func TestVoteExtensionRequiredHeight(t *testing.T) {
|
||||
for _, testCase := range []struct {
|
||||
name string
|
||||
@@ -2291,6 +2294,12 @@ func TestVoteExtensionRequiredHeight(t *testing.T) {
|
||||
initialRequiredHeight: 1,
|
||||
expectSuccessfulRound: false,
|
||||
},
|
||||
{
|
||||
name: "extension absent but required in future height",
|
||||
hasExtension: false,
|
||||
initialRequiredHeight: 2,
|
||||
expectSuccessfulRound: true,
|
||||
},
|
||||
} {
|
||||
t.Run(testCase.name, func(t *testing.T) {
|
||||
config := configSetup(t)
|
||||
|
||||
Reference in New Issue
Block a user