From 52a9421d88f9cca3c8463aa28bfc3086c9a68213 Mon Sep 17 00:00:00 2001 From: Simon Noetzlin Date: Fri, 10 Nov 2023 10:17:02 +0100 Subject: [PATCH] update util func --- testutil/crypto/evidence.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/testutil/crypto/evidence.go b/testutil/crypto/evidence.go index beac816097..1a2c2cbc7e 100644 --- a/testutil/crypto/evidence.go +++ b/testutil/crypto/evidence.go @@ -115,11 +115,14 @@ func UpdateHeaderCommitWithNilVotes(header *ibctmtypes.Header, validators []*tmt for _, v := range validators { // get validator index in valset idx, _ := valset.GetByAddress(v.Address) - s := commit.Signatures[idx] - // change BlockIDFlag to nil - s.BlockIDFlag = tmtypes.BlockIDFlagNil - // update the signatures - commit.Signatures[idx] = s + if idx != -1 { + // get validator commit sig + s := commit.Signatures[idx] + // change BlockIDFlag to nil + s.BlockIDFlag = tmtypes.BlockIDFlagNil + // update the signatures + commit.Signatures[idx] = s + } } // update the commit in client the header