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

This commit is contained in:
Julien Robert 2024-08-01 12:00:32 +02:00 committed by GitHub
parent aee9803a0a
commit 49179ebfec
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{