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

Bugfix: RPC/Wallet: Include HD key metadata in dumpwallet #11803

Open
wants to merge 4 commits into
base: master
from

Conversation

@luke-jr
Copy link
Member

@luke-jr luke-jr commented Nov 30, 2017

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)

Copy link
Member

@promag promag left a comment

Update test? Squash 2nd and 3rd commits?

src/wallet/rpcdump.cpp Show resolved Hide resolved
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)));

This comment has been minimized.

@promag

promag Dec 1, 2017
Member

Nit, partial unrelated change to what commit stands for.

src/wallet/rpcdump.cpp Outdated Show resolved Hide resolved
@jonasschnelli
Copy link
Member

@jonasschnelli jonasschnelli commented Dec 1, 2017

@luke-jr: can you please elaborate a little bit what situation this PR does improve?

@laanwj
Copy link
Member

@laanwj laanwj commented Jan 30, 2018

@luke-jr Can you please answer @jonasschnelli 's question? There is no rationale in the OP at all.

@luke-jr
Copy link
Member Author

@luke-jr luke-jr commented Jan 30, 2018

@MarcoFalke
Copy link
Member

@MarcoFalke MarcoFalke commented Jan 30, 2018

That should probably be moved to the OP, so it is recoverable from the merge commit body. (Note that we put the OP text in the merge commit body)

@MarcoFalke
Copy link
Member

@MarcoFalke MarcoFalke commented Mar 19, 2018

Needs rebase if still relevant

@luke-jr luke-jr force-pushed the luke-jr:bugfix_dumpwallet_hdkeypath branch Mar 31, 2018
@luke-jr
Copy link
Member Author

@luke-jr luke-jr commented Mar 31, 2018

Rebased

@MarcoFalke
Copy link
Member

@MarcoFalke MarcoFalke commented May 21, 2018

Needs rebase due to merge of #12924

@luke-jr luke-jr force-pushed the luke-jr:bugfix_dumpwallet_hdkeypath branch 2 times, most recently from 73d8c21 to 17d609c Nov 4, 2018
@DrahtBot DrahtBot removed the Needs rebase label Nov 4, 2018
@bitcoin bitcoin deleted a comment from ismail120572 Nov 5, 2018
@meshcollider
Copy link
Member

@meshcollider meshcollider commented Nov 10, 2018

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 importwallet is definitely something that needs to be done, ideally that should be done at the same time because they're mirror functions. But this doesn't break compatibility with the current importwallet so it should be ok to leave it for a future PR.

@luke-jr
Copy link
Member Author

@luke-jr luke-jr commented Nov 10, 2018

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?

@Sjors
Copy link
Member

@Sjors Sjors commented Nov 20, 2018

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 combo() descriptor after #14477.

@DrahtBot
Copy link
Contributor

@DrahtBot DrahtBot commented Dec 28, 2018

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

No conflicts as of last run.

@Sjors
Copy link
Member

@Sjors Sjors commented Feb 15, 2019

This has been fixed as part of #14021 (not just for importmulti):
schermafbeelding 2019-02-15 om 16 03 23

It could still be useful to switch over to inferred descriptors, so we also get the origin info.

@luke-jr luke-jr closed this Feb 15, 2019
@Sjors
Copy link
Member

@Sjors Sjors commented Feb 16, 2019

Just noticed that it's a seperate field now, but sill in the comment section, so we could move it to the left.

@luke-jr luke-jr reopened this Feb 16, 2019
@luke-jr luke-jr force-pushed the luke-jr:bugfix_dumpwallet_hdkeypath branch from 17d609c to 479c0cb Apr 6, 2019
@luke-jr
Copy link
Member Author

@luke-jr luke-jr commented Apr 6, 2019

Rebased

@Sjors
Copy link
Member

@Sjors Sjors commented Aug 15, 2019

Calling resident key metadata expert @achow101...

Copy link
Member

@achow101 achow101 left a comment

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);

This comment has been minimized.

@achow101

achow101 Aug 15, 2019
Member

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.

@luke-jr luke-jr force-pushed the luke-jr:bugfix_dumpwallet_hdkeypath branch from 479c0cb to 563dda4 Mar 29, 2020
@DrahtBot DrahtBot removed the Needs rebase label Mar 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

You can’t perform that action at this time.