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
rpc, wallet: Expose database format in getwalletinfo #20125
Conversation
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
Concept ACK |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approach ACK 56e1b81
Mind making the new Format
member function const
?
@ryanofsky fine by you? |
56e1b81
to
5e737a0
Compare
Concept/Approach ACK, this was the first thing I wanted to see when testing #19077. Looks like it's only missing tests. Maybe also add it to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested ACK modulo test coverage
RPC results
$ ./src/bitcoin-cli -rpcwallet= getwalletinfo
{
"walletname": "",
"walletversion": 169900,
"format": "bdb",
...
$ ./src/bitcoin-cli -rpcwallet=sqlite getwalletinfo
{
"walletname": "sqlite",
"walletversion": 169900,
"format": "sqlite",
...
help
Result:
{ (json object)
"walletname" : "str", (string) the wallet name
"walletversion" : n, (numeric) the wallet version
"format" : "str", (string) the database format (bdb or sqlite)
...
@jonatack thanks for testing, will pick this after base is merged. |
5e737a0
to
f33d6e1
Compare
Rebased. |
Test coverage commit at https://github.com/jonatack/bitcoin/commits/test-getwalletinfo-format-field, feel free to pull in or use. |
1083e8c
to
624bab0
Compare
Thanks @jonatack, included as is. |
Will need a release note here or added manually in https://github.com/bitcoin-core/bitcoin-devwiki/wiki. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 624bab0, tested on Linux Mint 20 (x86_64).
Tested in the GUI console :)
Mind making the new
Format
member functionconst
?@ryanofsky fine by you?
Didn't get what are concerns. 😃
He previously said that he dislikes interfaces that enforce const. Probably not relevant in this case. |
@@ -2465,6 +2466,7 @@ static RPCHelpMan getwalletinfo() | |||
int64_t kp_oldest = pwallet->GetOldestKeyPoolTime(); | |||
obj.pushKV("walletname", pwallet->GetName()); | |||
obj.pushKV("walletversion", pwallet->GetVersion()); | |||
obj.pushKV("format", pwallet->GetDatabase().Format()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure, since it is related to the "descriptors" bool field, maybe place "format" at the end right after "descriptors". IDK.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now it's related. But note that you can have descriptor wallets in bdb format.
Actually you can have a bdb descriptors wallet if you use a build before #19077.
I think this information is mildly useful for troubleshooting user issues, and for testing. |
How would it be possible to have a legacy-sqlite wallet or a descriptor-bdb wallet? This should only be useful for developers that ran master? |
No objection obviously. doesn't hurt ACK 624bab0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK 624bab0
…info 624bab0 test: add coverage for getwalletinfo format field (Jon Atack) 5e737a0 rpc, wallet: Expose database format in getwalletinfo (João Barbosa) Pull request description: Support for sqlite based wallets was added in bitcoin#19077. This PR adds the `format` key in `getwalletinfo` response, that can be `bdb` or `sqlite`. ACKs for top commit: jonatack: Tested ACK 624bab0 laanwj: Code review ACK 624bab0. MarcoFalke: doesn't hurt ACK 624bab0 hebasto: ACK 624bab0, tested on Linux Mint 20 (x86_64). meshcollider: utACK 624bab0 Tree-SHA512: a81f8530f040f6381d33e073a65f281993eccfa717424ab6e651c1203cbaf27794dcb7175570459e7fdaa211565bc060d0a3ecbe70d2b6f9c49b8d5071e4441c
Support for sqlite based wallets was added in #19077. This PR adds the
format
key ingetwalletinfo
response, that can bebdb
orsqlite
.