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: add ability to get/put raw db values #21991

Closed
wants to merge 1 commit into from

Conversation

holiman
Copy link
Contributor

@holiman holiman commented Dec 10, 2020

This PR is a bit experimental, and provides ability to modify the database contents. It's for being able to inspect, and potentially salvage, problems like reported in #21990 .
Example usage:

Putting a value

[user@work go-ethereum]$ ./build/bin/geth db.put 0x1337 0xdeadc0de
INFO [12-10|11:02:19.555] Maximum peer count                       ETH=50 LES=0 total=50
INFO [12-10|11:02:19.555] Smartcard socket not found, disabling    err="stat /run/pcscd/pcscd.comm: no such file or directory"
...
..
INFO [12-10|11:02:19.598] Opened ancient database                  database=/home/user/.ethereum/geth/chaindata/ancient
INFO [12-10|11:02:19.599] Freezer shutting down

Reading it:

[user@work go-ethereum]$ ./build/bin/geth db.get 0x1337
INFO [12-10|11:02:27.926] Maximum peer count                       ETH=50 LES=0 total=50
...
INFO [12-10|11:02:27.953] Opened ancient database                  database=/home/user/.ethereum/geth/chaindata/ancient
key 1337:
        deadc0de
INFO [12-10|11:02:27.955] Freezer shutting down

Overwriting it:

[user@work go-ethereum]$ ./build/bin/geth db.put 0x1337 0xcafebabe
INFO [12-10|11:02:36.959] Maximum peer count                       ETH=50 LES=0 total=50
...
INFO [12-10|11:02:36.987] Opened ancient database                  database=/home/user/.ethereum/geth/chaindata/ancient
Previous value:
deadc0de
INFO [12-10|11:02:36.988] Freezer shutting down

@holiman
Copy link
Contributor Author

holiman commented Dec 14, 2020

Closed in favour of #22014

@holiman holiman closed this Dec 14, 2020
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.

1 participant