Fixes #34378
A non-watch-only wallet allows to import descriptors with partial private keys, eg: a multisig descriptor with one private key and one public key. In case an xpub is imported in any such descriptors whose private key the wallet doesn’t have, then the gethdkeys RPC throws an unhandled error like below when the private keys are requested.
This fix ensures that such calls are properly handled by conditionally finding the corresponding xprv and the related functional test is accordingly updated.
0β bitcoincli -named gethdkeys private=true
1error code: -1
2error message:
3map::at: key not found