From 92a30346e3304e61f84c33492b35b82353fae6cb Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Wed, 20 Nov 2024 11:34:51 +0100 Subject: [PATCH] fix: only overwrite context chainID when necessary --- types/context.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/types/context.go b/types/context.go index 3f5778c638f1..ae93cbd99782 100644 --- a/types/context.go +++ b/types/context.go @@ -2,6 +2,7 @@ package types import ( "context" + "strings" "time" abci "github.com/cometbft/cometbft/api/cometbft/abci/v1" @@ -162,7 +163,10 @@ func (c Context) WithBlockHeader(header cmtproto.Header) Context { c.header = header // when calling withBlockheader on a new context, chainID in the struct will be empty - c.chainID = header.ChainID + if strings.TrimSpace(c.chainID) == "" { + c.chainID = header.ChainID + } + return c }