Skip to content

Commit ecb8a92

Browse files
colinlyguo0xmountaintop
authored andcommitted
fix(api-backend): disable finalized tag when rollup verify is disabled (#722)
1 parent f9a9592 commit ecb8a92

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

eth/api_backend.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ func (b *EthAPIBackend) HeaderByNumber(ctx context.Context, number rpc.BlockNumb
9292
// return block, nil
9393
// }
9494
if number == rpc.FinalizedBlockNumber {
95+
if !b.eth.config.EnableRollupVerify {
96+
return nil, errors.New("sync L1 finalized batch feature not enabled, cannot query L2 finalized block height")
97+
}
9598
finalizedBlockHeightPtr := rawdb.ReadFinalizedL2BlockNumber(b.eth.ChainDb())
9699
if finalizedBlockHeightPtr == nil {
97100
return nil, errors.New("L2 finalized block height not found in database")
@@ -152,6 +155,9 @@ func (b *EthAPIBackend) BlockByNumber(ctx context.Context, number rpc.BlockNumbe
152155
// return b.eth.blockchain.GetBlock(header.Hash(), header.Number.Uint64()), nil
153156
// }
154157
if number == rpc.FinalizedBlockNumber {
158+
if !b.eth.config.EnableRollupVerify {
159+
return nil, errors.New("sync L1 finalized batch feature not enabled, cannot query L2 finalized block height")
160+
}
155161
finalizedBlockHeightPtr := rawdb.ReadFinalizedL2BlockNumber(b.eth.ChainDb())
156162
if finalizedBlockHeightPtr == nil {
157163
return nil, errors.New("L2 finalized block height not found in database")

0 commit comments

Comments
 (0)