mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-23 05:06:43 +00:00
feat(l1 sync service): add flag for sync interval (#1241)
This commit is contained in:
parent
10b0905e5d
commit
c5fcd99e5a
5 changed files with 18 additions and 1 deletions
|
|
@ -170,6 +170,7 @@ var (
|
|||
utils.L1EndpointFlag,
|
||||
utils.L1ConfirmationsFlag,
|
||||
utils.L1DeploymentBlockFlag,
|
||||
utils.L1SyncIntervalFlag,
|
||||
utils.L1DisableMessageQueueV2Flag,
|
||||
utils.CircuitCapacityCheckEnabledFlag,
|
||||
utils.CircuitCapacityCheckWorkersFlag,
|
||||
|
|
|
|||
|
|
@ -233,6 +233,7 @@ var AppHelpFlagGroups = []flags.FlagGroup{
|
|||
utils.L1EndpointFlag,
|
||||
utils.L1ConfirmationsFlag,
|
||||
utils.L1DeploymentBlockFlag,
|
||||
utils.L1SyncIntervalFlag,
|
||||
utils.L1DisableMessageQueueV2Flag,
|
||||
utils.RollupVerifyEnabledFlag,
|
||||
utils.DASyncEnabledFlag,
|
||||
|
|
|
|||
|
|
@ -853,6 +853,10 @@ var (
|
|||
Name: "l1.sync.startblock",
|
||||
Usage: "L1 block height to start syncing from. Should be set to the L1 message queue deployment block number.",
|
||||
}
|
||||
L1SyncIntervalFlag = cli.DurationFlag{
|
||||
Name: "l1.sync.interval",
|
||||
Usage: "Poll interval for L1 message syncing (e.g., 2s, 10s, 1m)",
|
||||
}
|
||||
L1DisableMessageQueueV2Flag = &cli.BoolFlag{
|
||||
Name: "l1.disablemqv2",
|
||||
Usage: "Disable L1 message queue v2",
|
||||
|
|
@ -1470,6 +1474,9 @@ func setL1(ctx *cli.Context, cfg *node.Config) {
|
|||
if ctx.GlobalIsSet(L1DeploymentBlockFlag.Name) {
|
||||
cfg.L1DeploymentBlock = ctx.GlobalUint64(L1DeploymentBlockFlag.Name)
|
||||
}
|
||||
if ctx.GlobalIsSet(L1SyncIntervalFlag.Name) {
|
||||
cfg.L1SyncInterval = ctx.GlobalDuration(L1SyncIntervalFlag.Name)
|
||||
}
|
||||
if ctx.GlobalIsSet(L1DisableMessageQueueV2Flag.Name) {
|
||||
cfg.L1DisableMessageQueueV2 = ctx.GlobalBool(L1DisableMessageQueueV2Flag.Name)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import (
|
|||
"runtime"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/scroll-tech/go-ethereum/common"
|
||||
"github.com/scroll-tech/go-ethereum/crypto"
|
||||
|
|
@ -197,6 +198,8 @@ type Config struct {
|
|||
L1Confirmations rpc.BlockNumber `toml:",omitempty"`
|
||||
// L1 bridge deployment block number
|
||||
L1DeploymentBlock uint64 `toml:",omitempty"`
|
||||
// Poll interval for L1 message syncing
|
||||
L1SyncInterval time.Duration `toml:",omitempty"`
|
||||
// Explicitly disable L1 message queue V2 and only query from L1 message queue V1 (before EuclidV2)
|
||||
L1DisableMessageQueueV2 bool `toml:",omitempty"`
|
||||
// Is daSyncingEnabled
|
||||
|
|
|
|||
|
|
@ -100,12 +100,17 @@ func NewSyncService(ctx context.Context, genesisConfig *params.ChainConfig, node
|
|||
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
|
||||
pollInterval := nodeConfig.L1SyncInterval
|
||||
if pollInterval == 0 {
|
||||
pollInterval = DefaultPollInterval
|
||||
}
|
||||
|
||||
service := SyncService{
|
||||
ctx: ctx,
|
||||
cancel: cancel,
|
||||
client: client,
|
||||
db: db,
|
||||
pollInterval: DefaultPollInterval,
|
||||
pollInterval: pollInterval,
|
||||
latestProcessedBlock: latestProcessedBlock,
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue