fix: only overwrite context chainID when necessary (#22568)
This commit is contained in:
parent
6351dc3a73
commit
50c5963d96
@ -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
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user