From 504bffce4de1f2c2a1993ac58b39c3209b883ec0 Mon Sep 17 00:00:00 2001 From: William Banfield Date: Fri, 13 May 2022 17:06:52 -0400 Subject: [PATCH] add a method for requiring extensions --- types/params.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/types/params.go b/types/params.go index 670c533f0..6caffc917 100644 --- a/types/params.go +++ b/types/params.go @@ -102,6 +102,15 @@ type VoteParams struct { ExtensionRequireHeight int64 `json:"extension_require_height"` } +// RequireExtensions returns true if vote extensions are required at height h +// and false otherwise. +func (v VoteParams) RequireExtensions(h int64) bool { + if v.ExtensionRequireHeight == 0 { + return false + } + return h <= v.ExtensionRequireHeight +} + // DefaultConsensusParams returns a default ConsensusParams. func DefaultConsensusParams() *ConsensusParams { return &ConsensusParams{