fix(api-backend): disable finalized tag when rollup verify is disabled (#722)

This commit is contained in:
colin 2024-04-26 12:11:01 +08:00 committed by GitHub
parent 005db0370e
commit a860446eba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 1 deletions

View file

@ -77,6 +77,9 @@ func (b *EthAPIBackend) HeaderByNumber(ctx context.Context, number rpc.BlockNumb
return b.eth.blockchain.CurrentBlock().Header(), nil
}
if number == rpc.FinalizedBlockNumber {
if !b.eth.config.EnableRollupVerify {
return nil, errors.New("sync L1 finalized batch feature not enabled, cannot query L2 finalized block height")
}
finalizedBlockHeightPtr := rawdb.ReadFinalizedL2BlockNumber(b.eth.ChainDb())
if finalizedBlockHeightPtr == nil {
return nil, errors.New("L2 finalized block height not found in database")
@ -119,6 +122,9 @@ func (b *EthAPIBackend) BlockByNumber(ctx context.Context, number rpc.BlockNumbe
return b.eth.blockchain.CurrentBlock(), nil
}
if number == rpc.FinalizedBlockNumber {
if !b.eth.config.EnableRollupVerify {
return nil, errors.New("sync L1 finalized batch feature not enabled, cannot query L2 finalized block height")
}
finalizedBlockHeightPtr := rawdb.ReadFinalizedL2BlockNumber(b.eth.ChainDb())
if finalizedBlockHeightPtr == nil {
return nil, errors.New("L2 finalized block height not found in database")

View file

@ -24,7 +24,7 @@ import (
const (
VersionMajor = 5 // Major version component of the current release
VersionMinor = 3 // Minor version component of the current release
VersionPatch = 5 // Patch version component of the current release
VersionPatch = 6 // Patch version component of the current release
VersionMeta = "mainnet" // Version metadata to append to the version string
)