-
Notifications
You must be signed in to change notification settings - Fork 37.1k
Bugfix: RPC/Wallet: Include HD key metadata in dumpwallet #11803
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
Conversation
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.
Update test? Squash 2nd and 3rd commits?
src/wallet/rpcdump.cpp
Outdated
file << "inactivehdmaster=1"; | ||
} else { | ||
file << "change=1"; | ||
} | ||
file << strprintf(" # addr=%s%s\n", strAddr, (pwallet->mapKeyMetadata[keyid].hdKeypath.size() > 0 ? " hdkeypath="+pwallet->mapKeyMetadata[keyid].hdKeypath : "")); | ||
file << strprintf(" # addr=%s%s\n", strAddr, (meta.hdKeypath.empty() ? "" : (" hdkeypath=" + meta.hdKeypath))); |
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.
Nit, partial unrelated change to what commit stands for.
@luke-jr: can you please elaborate a little bit what situation this PR does improve? |
@luke-jr Can you please answer @jonasschnelli 's question? There is no rationale in the OP at all. |
b24b1c5
to
393511c
Compare
Rebased |
73d8c21
to
17d609c
Compare
Tested ACK 17d609c This isn't really a bugfix because there is no bug in the codebase which is fixed right? But I agree its a sensible change. Supporting it with |
I think it's a bugfix because without it (and another fix to importwallet), dump/import will produce a wallet missing the key metadata. Isn't the goal of these RPCs to produce the same wallet? |
Concept ACK and lightly tested 17d609c. Unrelated, I don't like that the address column depends on the currently active address type. We could replace it with an inferred |
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. |
This has been fixed as part of #14021 (not just for It could still be useful to switch over to inferred descriptors, so we also get the origin info. |
Just noticed that it's a seperate field now, but sill in the comment section, so we could move it to the left. |
17d609c
to
479c0cb
Compare
Rebased |
Calling resident key metadata expert @achow101... |
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.
Concept ACK
file << "inactivehdseed=1"; | ||
} else { | ||
file << "change=1"; | ||
} | ||
file << strprintf(" # addr=%s%s\n", strAddr, (pwallet->mapKeyMetadata[keyid].has_key_origin ? " hdkeypath="+WriteHDKeypath(pwallet->mapKeyMetadata[keyid].key_origin.path) : "")); | ||
if (meta.has_key_origin) { | ||
file << " hdkeypath=" + WriteHDKeypath(meta.key_origin.path); |
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.
We should also write out the master fingerprint here too (part of key_origin
). I think instead of a separate field for that, we could instead write that in the same way descriptors and psbt do key origin information, i.e. fingerprint instead of m
in the path.
479c0cb
to
563dda4
Compare
Concept ACK Will try this today. Wallet with metadata is obviously better than wallet missing the key metadata. This PR will complete 1337 days next week |
Compiled and tried in POP!_OS with a new wallet (legacy / testnet). Diff for the dump files: https://ghostbin.com/paste/L2SXs. Observed the below things when comparing dump files for Master and PR branch:
-cPUphC3iKWVx5HVcYimYKjvL1xn6uSHS2HKZdoLoKM1RzQkihNiD 2021-07-22T14:38:59Z reserve=1 # addr=tb1qp7m7nzhp9c4z7069m9rvrpp6tk6g4hqpj07t9l hdkeypath=m/0'/0'/8'
+cPUphC3iKWVx5HVcYimYKjvL1xn6uSHS2HKZdoLoKM1RzQkihNiD 2021-07-22T14:38:59Z reserve=1 hdkeypath=m/0'/0'/8' hdseedid=b01cf0b04e2799dab0a3658d7b59791a02c5ec86 # addr=tb1qp7m7nzhp9c4z7069m9rvrpp6tk6g4hqpj07t9l
|
I think commits should be squashed. This tests failed on my env though. Is it just me? feature_backwards_compatibility.py --legacy-wallet | ✖ Failed | 1 s
feature_taproot.py --previous_release | ✖ Failed | 1 s
mempool_compatibility.py | ✖ Failed | 1 s
rpc_createmultisig.py --legacy-wallet | ✖ Failed | 103 s
rpc_signrawtransaction.py --descriptors | ✖ Failed | 105 s
wallet_upgradewallet.py --legacy-wallet | ✖ Failed | 1 s This is exactly how I fetched the branch, compiled the binnaries and ran the tests.
Checked my HEAD commit within my local PR copy and I'm getting 8642fbd which differs from the last commit I see on the commit tab here, am I doing something wrong? |
Tested on master for legacy wallets: I get an extended private masterkey Then a list of (private key, address, hdkeypath); although very out of order. Somewhere in there, is the hdseed Master for descriptor wallets:
Tested on 563dda4: Legacy: Extended private master key. Then list of (private key, hdkeypath, hdseedid, address). Changes are address is moved to the end of the list, and addition of hdseedid. The keys are still out of order, and the hdseed is also still randomly in the list. Descriptor: Unable to create descriptor wallet (either through the GUI or console), so unable to test. Possible improvements?:
|
Maybe I was thinking of |
🐙 This pull request conflicts with the target branch and needs rebase. Want to unsubscribe from rebase notifications on this pull request? Just convert this pull request to a "draft". |
There hasn't been much activity lately and the patch still needs rebase. What is the status here?
|
Closing this as it has not had any activity in a while. If you are interested in continuing work on this, please leave a comment so that it can be reopened. |
When restoring a backup, we should restore the wallet metadata. This moves some of it out of "comment" sections so that it can be sensibly handled by parsing tools.
(
importwallet
doesn't currently support it, but that's another matter to address)