mirror of
https://github.com/tendermint/tendermint.git
synced 2026-02-10 14:00:33 +00:00
types: Reformat ExtendedCommitSig.BlockID
Signed-off-by: Thane Thomson <connect@thanethomson.com>
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user