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/utils: open db in readonly when dev datadir exists #24298

Merged
merged 1 commit into from
Jan 27, 2022

Conversation

s1na
Copy link
Contributor

@s1na s1na commented Jan 26, 2022

The PR #24119 introduced a regression where if the specified datadir for dev mode didn't exist geth wouldn't start. #24281 fixed that regression.

In this PR we add an extra check to see if the datadir exists. If so, then the db is opened in read-only. Otherwise it's opened in write-mode so leveldb can create the relevant files. Note that this is not the live db that dev mode uses for its operations. It's only opened temporarily to check for existence of a genesis block and closed immediately and hence doesn't need write access.

Copy link
Contributor

@holiman holiman left a comment

Choose a reason for hiding this comment

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

LGTM

@holiman holiman added this to the 1.10.16 milestone Jan 27, 2022
@holiman holiman merged commit e282246 into ethereum:master Jan 27, 2022
sidhujag pushed a commit to syscoin/go-ethereum that referenced this pull request Jan 28, 2022
JacekGlen pushed a commit to JacekGlen/go-ethereum that referenced this pull request May 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants