Linked to #28057.
Currently, the InferScript
function returns an invalid descriptor when it tries to infer a p2sh-p2pkh script whose pubkey is not known by the wallet.
This behavior occurs because the inference process bypasses the pkh
subscript when the pubkey is not contained by the wallet (no pubkey provider), interpreting it as a sh(addr(ADDR))
descriptor. Then, the failure arises because the addr()
function is restricted to being used only at the top level.
For reviewers, would recommend to start by examining the functional test to understand the context and the circumstances on which this can result in a fatal error (e.g. during the migration process).