Skip to content

Commit

Permalink
fix(api-backend): disable finalized tag when rollup verify is disabled (
Browse files Browse the repository at this point in the history
  • Loading branch information
colinlyguo authored and 0xmountaintop committed Jun 26, 2024
1 parent f9a9592 commit ecb8a92
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions eth/api_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ func (b *EthAPIBackend) HeaderByNumber(ctx context.Context, number rpc.BlockNumb
// return block, 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")
Expand Down Expand Up @@ -152,6 +155,9 @@ func (b *EthAPIBackend) BlockByNumber(ctx context.Context, number rpc.BlockNumbe
// return b.eth.blockchain.GetBlock(header.Hash(), header.Number.Uint64()), 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")
Expand Down

0 comments on commit ecb8a92

Please sign in to comment.