fix(keymap): backport use of correct derivation_path for keys with origin#867
fix(keymap): backport use of correct derivation_path for keys with origin#867oleonardolima wants to merge 2 commits into
derivation_path for keys with origin#867Conversation
|
Do you want review mate? Why's it draft? |
Yeah, I was just waiting for CI, it should be ready to go. |
|
I'll move this one back to draft while I fix the issue mentioned at the summit, and backport all the fixes at once. |
51df447 to
d6a94e3
Compare
|
@oleonardolima just a ping, can this be updated and made ready to review now? |
I'll rebase it and get it ready for review today. |
@notmandatory I updated the original fix in #872 (also needs review), I'm backporting it here now. |
d6a94e3 to
f3d1b63
Compare
- backports rust-bitcoin#872 fixes for the implementation of `GetKey` for `Xprv` with `KeyRequest::Bip32`, when the the key_origin information is available. - introduces a new test for a scenario with no wildcard used, a specific derivation index is used instead.
- backports introduced rust-bitcoin#872 table-driven test cases for `get_key_xpriv_with_key_origin` with named fields - drop redundant key parsing, and build requests from explicit key sources Assisted-by: Claude Opus 4.8
f3d1b63 to
3f77767
Compare
I updated this PR and added new test scenarios, it should be ready to review. cc'in @noahjoeris as you had interest in this and a review would be appreciated. |
backports #872
Description
It backports the fix for deriving the private key correctly in scenarios where the key origin is available, see #872.
The GetKey for DescriptorSecretKey (and thus KeyMap) returned the wrong key when an extended private key with key origin info was queried via KeyRequest::Bip32.
The key request path is master-relative, but the xkey is anchored at its origin (e.g. [d34db33f/84h/1h/0h]). The old code stripped the path returned by matches(); the fix strips the origin prefix instead (and uses the full path when there is no origin) before deriving from the xkey.
cherry-picks 20ae466 and a2f4497.
Changelog notice
Checklists
Bugfixes: