mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-26 09:54:19 +00:00
log on stripped extensions
This commit is contained in:
+6
-1
@@ -1105,11 +1105,16 @@ func (ec *ExtendedCommit) EnsureExtensions() error {
|
||||
// StripExtensions removes all VoteExtension data from an ExtendedCommit. This
|
||||
// is useful when dealing with an ExendedCommit but vote extension data is
|
||||
// expected to be absent.
|
||||
func (ec *ExtendedCommit) StripExtensions() {
|
||||
func (ec *ExtendedCommit) StripExtensions() bool {
|
||||
stripped := false
|
||||
for idx := range ec.ExtendedSignatures {
|
||||
if len(ec.ExtendedSignatures[idx].Extension) > 0 || len(ec.ExtendedSignatures[idx].ExtensionSignature) > 0 {
|
||||
stripped = true
|
||||
}
|
||||
ec.ExtendedSignatures[idx].Extension = nil
|
||||
ec.ExtendedSignatures[idx].ExtensionSignature = nil
|
||||
}
|
||||
return stripped
|
||||
}
|
||||
|
||||
// ToCommit converts an ExtendedCommit to a Commit by removing all vote
|
||||
|
||||
+5
-2
@@ -112,11 +112,14 @@ func (vote *Vote) CommitSig() CommitSig {
|
||||
}
|
||||
}
|
||||
|
||||
// StripExtensions removes any extension data from the vote. Useful if the
|
||||
// StripExtension removes any extension data from the vote. Useful if the
|
||||
// chain has not enabled vote extensions.
|
||||
func (vote *Vote) StripExtensions() {
|
||||
// Returns true if extension data was present before stripping and false otherwise.
|
||||
func (vote *Vote) StripExtension() bool {
|
||||
stripped := len(vote.Extension) > 0 || len(vote.ExtensionSignature) > 0
|
||||
vote.Extension = nil
|
||||
vote.ExtensionSignature = nil
|
||||
return stripped
|
||||
}
|
||||
|
||||
// ExtendedCommitSig attempts to construct an ExtendedCommitSig from this vote.
|
||||
|
||||
Reference in New Issue
Block a user