Skip to content

Commit

Permalink
fix: only overwrite context chainID when necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
damiannolan committed Nov 20, 2024
1 parent 6351dc3 commit 92a3034
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion types/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package types

import (
"context"
"strings"
"time"

abci "github.com/cometbft/cometbft/api/cometbft/abci/v1"
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit 92a3034

Please sign in to comment.