Only include extension if we have received txs

It's unclear at this point why this is necessary to ensure that the
application's local app_hash matches that committed in the previous
block.

Signed-off-by: Thane Thomson <connect@thanethomson.com>
This commit is contained in:
Thane Thomson
2022-03-30 19:58:15 -04:00
parent 685487a605
commit a8505f0871

View File

@@ -331,7 +331,7 @@ func (app *Application) PrepareProposal(req abci.RequestPrepareProposal) abci.Re
extCount++
}
// We only generate our special transaction if we have vote extensions
if extCount > 0 {
if extCount > 0 && len(req.Txs) > 0 {
extTxPrefix := fmt.Sprintf("%s=", voteExtensionKey)
extTx := []byte(fmt.Sprintf("%s%d", extTxPrefix, sum))
app.logger.Info("preparing proposal with custom transaction from vote extensions", "tx", extTx)