From 7c24d56743167e37424fb3ebcce387dfe0f548b1 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 1 Aug 2024 12:31:11 +0200 Subject: [PATCH] fix(server/v2/cometbft): fix slice appending (backport #21142) (#21145) Co-authored-by: Julien Robert --- server/v2/cometbft/abci.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/v2/cometbft/abci.go b/server/v2/cometbft/abci.go index 45b1d962f8..372886792e 100644 --- a/server/v2/cometbft/abci.go +++ b/server/v2/cometbft/abci.go @@ -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{