When a ConstPubkeyProvider
is xonly, the stored pubkey does not necessarily have the correct parity bit. ToPrivateString()
is correctly handling this by looking up the keys for both parity bits, but GetPrivKey
does not. This results in not finding the private key when it is actually available if its pubkey has the other parity bit value.
To fix this, this key finding is refactored into GetPrivKey()
so that its behavior is corrected, and ToPrivateString()
is changed to use GetPrivKey()
as well.
Additionally, the descriptor test checks are updated to include a check for ExpandPrivate()
to verify that both the parsed public and private descriptors produce SigningProvider
s with the same contents.
Fixes #31589