Embed CommitSig into ExtendedCommitSig instead of duplicating fields

Signed-off-by: Thane Thomson <connect@thanethomson.com>
This commit is contained in:
Thane Thomson
2022-05-07 12:30:42 -04:00
parent fe5220bca6
commit 6389f2ff0c
6 changed files with 61 additions and 117 deletions

View File

@@ -591,10 +591,12 @@ func makeExtCommit(height int64, valAddr []byte) *types.ExtendedCommit {
Height: height,
BlockID: types.BlockID{},
ExtendedSignatures: []types.ExtendedCommitSig{{
BlockIDFlag: types.BlockIDFlagCommit,
ValidatorAddress: valAddr,
Timestamp: defaultEvidenceTime,
Signature: []byte("Signature"),
CommitSig: types.CommitSig{
BlockIDFlag: types.BlockIDFlagCommit,
ValidatorAddress: valAddr,
Timestamp: defaultEvidenceTime,
Signature: []byte("Signature"),
},
}},
}
}

View File

@@ -437,7 +437,7 @@ func buildLastExtendedCommitInfo(ec *types.ExtendedCommit, store Store, initialH
if ecs.BlockIDFlag == types.BlockIDFlagCommit {
// We only care about vote extensions if a validator has voted to
// commit.
ext = ecs.VoteExtension
ext = ecs.Extension
}
var vpb abci.Validator
// The ValidatorAddress field is empty when their vote is absent.

View File

@@ -30,10 +30,12 @@ type cleanupFunc func()
// timestamp
func makeTestExtCommit(height int64, timestamp time.Time) *types.ExtendedCommit {
extCommitSigs := []types.ExtendedCommitSig{{
BlockIDFlag: types.BlockIDFlagCommit,
ValidatorAddress: tmrand.Bytes(crypto.AddressSize),
Timestamp: timestamp,
Signature: []byte("Signature"),
CommitSig: types.CommitSig{
BlockIDFlag: types.BlockIDFlagCommit,
ValidatorAddress: tmrand.Bytes(crypto.AddressSize),
Timestamp: timestamp,
Signature: []byte("Signature"),
},
}}
return &types.ExtendedCommit{
Height: height,