fix(server/v2/cometbft): fix slice appending (backport #21142) (#21145)

Co-authored-by: Julien Robert <julien@rbrt.fr>
This commit is contained in:
mergify[bot] 2024-08-01 12:31:11 +02:00 committed by GitHub
parent 261285c8fa
commit 7c24d56743
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -315,7 +315,7 @@ func (c *Consensus[T]) PrepareProposal(
}
decodedTxs := make([]T, len(req.Txs))
for _, tx := range req.Txs {
for i, tx := range req.Txs {
decTx, err := c.txCodec.Decode(tx)
if err != nil {
// TODO: vote extension meta data as a custom type to avoid possibly accepting invalid txs
@ -323,7 +323,8 @@ func (c *Consensus[T]) PrepareProposal(
c.logger.Error("failed to decode tx", "err", err)
continue
}
decodedTxs = append(decodedTxs, decTx)
decodedTxs[i] = decTx
}
ciCtx := contextWithCometInfo(ctx, comet.Info{