Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/geth: exit when freezer has legacy receipts #24943

Merged
merged 3 commits into from May 26, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions cmd/geth/config.go
Expand Up @@ -164,7 +164,7 @@ func makeFullNode(ctx *cli.Context) (*node.Node, ethapi.Backend) {
}
backend, eth := utils.RegisterEthService(stack, &cfg.Eth)
// Warn users to migrate if they have a legacy freezer format.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if eth != nil {
if eth != nil && !ctx.GlobalIsSet(utils.IgnoreLegacyReceiptsFlag.Name) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

firstIdx := uint64(0)
// Hack to speed up check for mainnet because we know
// the first non-empty block.
Expand All @@ -176,7 +176,8 @@ func makeFullNode(ctx *cli.Context) (*node.Node, ethapi.Backend) {
if err != nil {
log.Error("Failed to check db for legacy receipts", "err", err)
} else if isLegacy {
log.Warn("Database has receipts with a legacy format. Please run `geth db freezer-migrate`.")
stack.Close()
utils.Fatalf("Database has receipts with a legacy format. Please run `geth db freezer-migrate`.")
}
}

Expand Down
1 change: 1 addition & 0 deletions cmd/geth/main.go
Expand Up @@ -151,6 +151,7 @@ var (
utils.GpoMaxGasPriceFlag,
utils.GpoIgnoreGasPriceFlag,
utils.MinerNotifyFullFlag,
utils.IgnoreLegacyReceiptsFlag,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

configFileFlag,
}, utils.NetworkFlags, utils.DatabasePathFlags)

Expand Down
4 changes: 4 additions & 0 deletions cmd/utils/flags.go
Expand Up @@ -566,6 +566,10 @@ var (
Name: "nocompaction",
Usage: "Disables db compaction after import",
}
IgnoreLegacyReceiptsFlag = cli.BoolFlag{
Name: "ignore-legacy-receipts",
Usage: "Geth will start up even if there are legacy receipts in freezer",
}
// RPC settings
IPCDisabledFlag = cli.BoolFlag{
Name: "ipcdisable",
Expand Down