Files
evm/eth/chain_with_final_block.go
zeekay 8bc9dd01a8 Fix CI: Go version and script permissions
- Change Go version from 1.24.6 to 1.22.8 (stable version)
- Ensure all build scripts have executable permissions
- Fix covdata issue by using stable Go version
- CI should now pass all checks
2025-09-19 05:56:47 +00:00

28 lines
727 B
Go

// Copyright (C) 2019-2025, Lux Industries, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
//nolint:unused
package eth
import (
"github.com/luxfi/evm/core"
"github.com/luxfi/geth/core/types"
)
const blocksToKeep = 604_800 // Approx. 2 weeks worth of blocks assuming 2s block time
type chainWithFinalBlock struct {
*core.BlockChain
}
// CurrentFinalBlock returns the current block below which blobs should not
// be maintained anymore for reorg purposes.
func (c *chainWithFinalBlock) CurrentFinalBlock() *types.Header {
lastAccepted := c.LastAcceptedBlock().Header().Number.Uint64()
if lastAccepted <= blocksToKeep {
return nil
}
return c.GetHeaderByNumber(lastAccepted - blocksToKeep)
}