Use parseVoteExtension instead of custom parsing in PrepareProposal

Signed-off-by: Thane Thomson <connect@thanethomson.com>
This commit is contained in:
Thane Thomson
2022-03-30 08:26:06 -04:00
parent 7d1f9288f8
commit 685487a605

View File

@@ -320,10 +320,10 @@ func (app *Application) PrepareProposal(req abci.RequestPrepareProposal) abci.Re
if !vote.SignedLastBlock || len(vote.VoteExtension) == 0 {
continue
}
extValue, errVal := binary.Varint(vote.VoteExtension)
extValue, err := parseVoteExtension(vote.VoteExtension)
// This should have been verified in VerifyVoteExtension
if errVal <= 0 {
panic(fmt.Sprintf("Failed to parse vote extension. Got return value %d", errVal))
if err != nil {
panic(fmt.Errorf("failed to parse vote extension in PrepareProposal: %w", err))
}
valAddr := crypto.Address(vote.Validator.Address)
app.logger.Info("got vote extension value in PrepareProposal", "valAddr", valAddr, "value", extValue)