types: Reformat ExtendedCommitSig.BlockID

Signed-off-by: Thane Thomson <connect@thanethomson.com>
This commit is contained in:
Thane Thomson
2022-05-04 14:12:15 -04:00
parent 24d1e6da01
commit a3b3415a3a

View File

@@ -777,19 +777,18 @@ func (ecs ExtendedCommitSig) String() string {
)
}
// BlockID returns the block ID associated with this extended commit signature,
// if any. If the block ID flag is neither absent, nil nor commit, this panics.
// If the block ID flag is absent or nil this returns an empty BlockID.
func (ecs ExtendedCommitSig) BlockID(commitBlockID BlockID) BlockID {
var blockID BlockID
switch ecs.BlockIDFlag {
case BlockIDFlagAbsent:
blockID = BlockID{}
case BlockIDFlagAbsent, BlockIDFlagNil:
return BlockID{}
case BlockIDFlagCommit:
blockID = commitBlockID
case BlockIDFlagNil:
blockID = BlockID{}
return commitBlockID
default:
panic(fmt.Sprintf("Unknown BlockIDFlag: %v", ecs.BlockIDFlag))
}
return blockID
}
// ValidateBasic checks whether the structure is well-formed.