-
Notifications
You must be signed in to change notification settings - Fork 36.6k
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
wallet: listdescriptors uses normalized descriptor form #21277
Conversation
Concept ACK! Thank you. |
What does it currently return here? Before/after would be nice. Maybe it's ToString that needs to get revised? Would be nice to avoid needing the wallet unlocked to simply listdescriptors... |
Updated description to show before/after.
In general I agree, but to derive normalised descriptors for hardened derivations we need private keys. UPD: Apparently, I didn't save the updated description at time of posting. Fixed now |
I'd agree that needing to have the wallet unlocked is a drawback. But the thing is that the current output is not really useful for anything (I think). You could say it's not even a valid descriptor as it does a hardened dirivation from a E.g. like
Hmm. It might be an idea to store these at generation time. |
It's totally doable, but doesn't it violate users security assumptions? If I have my master private key encrypted at rest I would be unpleasantly surprised to find child private keys in memory. |
I mean the public key, not the private key. This is all about public derivation right? I'm certainly not suggesting private keys should be stored unencrypted. |
The xpub cache should actually allow us to generate the normalized form without needing to unlock the wallet. After all, that is how we are able to refresh the address pool when the wallet is locked. However modifying the normalization function to do that may be an invasive change. I can look into doing that. Regardless, doing that would not materially effect this PR and I think it can be done in a followup. ACK a69c3b3 |
…or form a69c3b3 wallet: listdescriptors uses normalized descriptor form (Ivan Metlushko) Pull request description: Rationale: show importable descriptors with `listdescriptors` RPC It uses bitcoin#19136 to derive xpub at the last hardened step. **Before**: ``` [ { "desc": "wpkh(tpubD6NzVbkrYhZ4YUQRJL49TWw1VR5v3QKUNYaGGMUfJUm19x5ZqQ2hEiPiYbAQvD2nHoPGQGPg3snLPM8sjmYpvx7XQhkmyfk8xhsUwKbXzyh/84'/1'/0'/0/*)#p4cn3erf", "timestamp": 1613982591, "active": true, "internal": false, "range": [ 0, 999 ], "next": 0 }, ... ] ``` **After**: ``` [ { "desc": "wpkh([d4ade89c/84'/1'/0']tpubDDUEYcVXy6Vh5meHvcXN3sAr4k3fWwLZGpAHbkAHL8EnkDxp4d99CjNhJHfM2fUJicANvAKnCZS6XaVAgwAeKYc1KesGCN5qbQ25qQHrRxM/0/*)#8wq8rcft", "timestamp": 1613982591, "active": true, "internal": false, "range": [ 0, 999 ], "next": 0 }, ... ] ``` ACKs for top commit: achow101: ACK a69c3b3 Tree-SHA512: 4f92e726cb8245aa0b520729cfd272945f0c66830f0555544e0618883aca516318543fa6ab1862058c64b4e4ed54ad1da953e032f4846eef7454122031c1b005
Github-Pull: bitcoin#21277 Rebased-From: a69c3b3
Rationale: show importable descriptors with
listdescriptors
RPCIt uses #19136 to derive xpub at the last hardened step.
Before:
After: