From e4329f55a6874d3f0ff805b998818816c4a83bdf Mon Sep 17 00:00:00 2001 From: brewmaster012 <88689859+brewmaster012@users.noreply.github.com> Date: Wed, 6 Sep 2023 08:58:14 -0500 Subject: [PATCH] fix: de-deduplicate inTxHashToCctx (#1077) Co-authored-by: brewmaster012 <> --- x/crosschain/keeper/keeper_cross_chain_tx.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/x/crosschain/keeper/keeper_cross_chain_tx.go b/x/crosschain/keeper/keeper_cross_chain_tx.go index 60cc186ec4..8fd5fdc2da 100644 --- a/x/crosschain/keeper/keeper_cross_chain_tx.go +++ b/x/crosschain/keeper/keeper_cross_chain_tx.go @@ -25,7 +25,16 @@ func (k Keeper) SetCctxAndNonceToCctxAndInTxHashToCctx(ctx sdk.Context, send typ // set mapping inTxHash -> cctxIndex in, _ := k.GetInTxHashToCctx(ctx, send.InboundTxParams.InboundTxObservedHash) in.InTxHash = send.InboundTxParams.InboundTxObservedHash - in.CctxIndex = append(in.CctxIndex, send.Index) + found := false + for _, cctxIndex := range in.CctxIndex { + if cctxIndex == send.Index { + found = true + break + } + } + if !found { + in.CctxIndex = append(in.CctxIndex, send.Index) + } k.SetInTxHashToCctx(ctx, in) tss, found := k.GetTSS(ctx)