optim: shallow copy block header in Context (#19966)
This commit is contained in:
parent
24d44b6506
commit
a6f3fbfbeb
@ -92,6 +92,7 @@ Every module contains its own CHANGELOG.md. Please refer to the module you are i
|
||||
* (types) [#18963](https://github.com/cosmos/cosmos-sdk/pull/18963) Swap out amino json encoding of `ABCIMessageLogs` for std lib json encoding
|
||||
* (x/auth) [#19651](https://github.com/cosmos/cosmos-sdk/pull/19651) Allow empty public keys in `GetSignBytesAdapter`.
|
||||
* (x/genutil) [#19735](https://github.com/cosmos/cosmos-sdk/pull/19735) Update genesis api to match new `appmodule.HasGenesis` interface.
|
||||
* (server) [#19966](https://github.com/cosmos/cosmos-sdk/pull/19966) Return BlockHeader by shallow copy in server Context.
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
|
||||
@ -6,7 +6,6 @@ import (
|
||||
|
||||
abci "github.com/cometbft/cometbft/abci/types"
|
||||
cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
|
||||
"github.com/cosmos/gogoproto/proto"
|
||||
|
||||
"cosmossdk.io/core/comet"
|
||||
"cosmossdk.io/core/header"
|
||||
@ -91,10 +90,9 @@ func (c Context) StreamingManager() storetypes.StreamingManager { return c.strea
|
||||
func (c Context) CometInfo() comet.Info { return c.cometInfo }
|
||||
func (c Context) HeaderInfo() header.Info { return c.headerInfo }
|
||||
|
||||
// clone the header before returning
|
||||
// BlockHeader returns the header by value.
|
||||
func (c Context) BlockHeader() cmtproto.Header {
|
||||
msg := proto.Clone(&c.header).(*cmtproto.Header)
|
||||
return *msg
|
||||
return c.header
|
||||
}
|
||||
|
||||
// HeaderHash returns a copy of the header hash obtained during abci.RequestBeginBlock
|
||||
|
||||
Loading…
Reference in New Issue
Block a user