-
Notifications
You must be signed in to change notification settings - Fork 38.7k
[Wallet] use CHDPubKey, don't store child priv keys in db, derive on the fly #9298
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
e75d2cb to
c1c86a3
Compare
|
Can you explain a bit of motivation for this? |
c1c86a3 to
2b61ef8
Compare
Sure. Sorry for leaving that out in the main description. 1.) Reduce amount of stored data in wallet.dat |
src/wallet/wallet.h
Outdated
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.
The comment here should be different compared to the FEATURE_HD.
src/wallet/wallet.cpp
Outdated
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.
SPC added to the already translated string? Yes/No here?
|
2.) Don't expose each child private key in wallet.dat
I think this means salvagewallet no longer works for hd wallets as it
previously did. This could potentially lead to loss of coins for
inexperienced users, because it is currently not easily possible to
recover the HD wallet after salvagewallet, nor is is possible to
recover the child keys, if they are not saved...
|
2b61ef8 to
0841ac8
Compare
0841ac8 to
3fd850a
Compare
Right. This is a good point.
Before implementing this, I think some Concept ACKs/NACKs would be required. |
promag
left a comment
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.
| assert(secret.VerifyPubKey(pubkey)); | ||
|
|
||
| // store metadata | ||
| mapKeyMetadata[pubkey.GetID()] = metadata; |
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.
This could stay in GenerateNewKey?
|
|
||
| // store metadata | ||
| mapKeyMetadata[pubkey.GetID()] = metadata; | ||
| if (!nTimeFirstKey || metadata.nCreateTime < nTimeFirstKey) |
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.
After rebase use UpdateTimeFirstKey(). Also could stay in GenerateNewKey?
|
|
||
| bool CWallet::LoadHDPubKey(const CHDPubKey &hdPubKey) | ||
| { | ||
| AssertLockHeld(cs_wallet); // mapKeyMetadata |
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.
Wrong comment.
|
|
||
| bool CWallet::AddHDPubKey(const CExtPubKey &extPubKey) | ||
| { | ||
| AssertLockHeld(cs_wallet); // mapKeyMetadata |
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.
Wrong comment.
|
@jonasschnelli I think this is generally the direction to go in, and it's also part of what my idea for refactoring accomplishes in a different way (https://gist.github.com/sipa/125cfa1615946d0c3f3eec2ad7f250a2). Do you think this is worth pursuing on its own? |
| There hasn't been much activity lately and the patch still needs rebase, so I am closing this for now. Please let me know when you want to continue working on this, so the pull request can be re-opened. |
Adds a new database record (
"hdpubkey") reflected by classCHDPubKey.Dump functions are unchanged, will result in deriving the keys on the fly.
Not backward compatible. Ideally combined with HD chain split #9294.