From badd430a0426f6a7deda775698df6e71863a3390 Mon Sep 17 00:00:00 2001 From: William Banfield Date: Fri, 13 May 2022 16:32:19 -0400 Subject: [PATCH] make extended commit sig optional in type --- types/block.go | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/types/block.go b/types/block.go index 61fac70e3..94a2ed296 100644 --- a/types/block.go +++ b/types/block.go @@ -763,18 +763,13 @@ func (ecs ExtendedCommitSig) ValidateBasic() error { return nil } - // We expect there to not be any vote extension or vote extension signature - // on nil or absent votes. - if len(ecs.Extension) != 0 { - return fmt.Errorf("vote extension is present for commit sig with block ID flag %v", ecs.BlockIDFlag) - } - if len(ecs.ExtensionSignature) != 0 { - return fmt.Errorf("vote extension signature is present for commit sig with block ID flag %v", ecs.BlockIDFlag) + if len(ecs.ExtensionSignature) == 0 && len(ecs.Extension) != 0 { + return fmt.Errorf("vote extension signature absent on vote with extension") } return nil } -func (ecs ExtendedCommitSig) ValidateExtension() error { +func (ecs ExtendedCommitSig) EnsureExtension() error { if len(ecs.ExtensionSignature) == 0 { return errors.New("vote extension signature is missing") }