mirror of
https://github.com/tendermint/tendermint.git
synced 2026-02-08 21:10:10 +00:00
Perform additional check in ProcessProposal for special txs generated by vote extensions
Signed-off-by: Thane Thomson <connect@thanethomson.com>
This commit is contained in:
@@ -379,10 +379,19 @@ func (app *Application) PrepareProposal(req abci.RequestPrepareProposal) abci.Re
|
||||
// It accepts any proposal that does not contain a malformed transaction.
|
||||
func (app *Application) ProcessProposal(req abci.RequestProcessProposal) abci.ResponseProcessProposal {
|
||||
for _, tx := range req.Txs {
|
||||
_, _, err := parseTx(tx)
|
||||
k, v, err := parseTx(tx)
|
||||
if err != nil {
|
||||
app.logger.Error("malformed transaction in ProcessProposal", "tx", tx, "err", err)
|
||||
return abci.ResponseProcessProposal{Status: abci.ResponseProcessProposal_REJECT}
|
||||
}
|
||||
// Additional check for vote extension-related txs
|
||||
if k == voteExtensionKey {
|
||||
_, err := strconv.Atoi(v)
|
||||
if err != nil {
|
||||
app.logger.Error("malformed vote extension transaction", k, v, "err", err)
|
||||
return abci.ResponseProcessProposal{Status: abci.ResponseProcessProposal_REJECT}
|
||||
}
|
||||
}
|
||||
}
|
||||
return abci.ResponseProcessProposal{Status: abci.ResponseProcessProposal_ACCEPT}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user