Add strong guarantee in extendedCommitInfo that the number of votes corresponds

Signed-off-by: Thane Thomson <connect@thanethomson.com>
This commit is contained in:
Thane Thomson
2022-03-28 11:45:06 -04:00
parent fab3cd0932
commit 620c3236ec

View File

@@ -441,6 +441,9 @@ func buildLastCommitInfo(block *types.Block, store Store, initialHeight int64) a
// precisely to those provided in the list of votes, such that vote extensions
// can be correlated with the votes in the commit.
func extendedCommitInfo(c abci.CommitInfo, votes []*types.Vote) abci.ExtendedCommitInfo {
if len(c.Votes) != len(votes) {
panic(fmt.Sprintf("extendedCommitInfo: number of votes from commit differ from the number of votes supplied (%d != %d)", len(c.Votes), len(votes)))
}
vs := make([]abci.ExtendedVoteInfo, len(c.Votes))
for i := range vs {
var ext []byte