When attempting to sign a transaction involving an external signer, if the device isn’t connected we throw an std::runtime_error
. This prevents the (mainly GUI) code that’s actually supposed to handle this case from running.
This PR returns a PSBTError::EXTERNAL_SIGNER_NOT_FOUND
instead of throwing.
The first commit is a refactor to have GetExternalSigner()
return a util::Result<ExternalSigner>
so the caller can decide how to handle the error. There are two other places where call GetExternalSigner()
which this PR doesn’t change (which I think is fine there).
Before:
After (the translation already exist):
Fixes #32426
Additionally use LogWarning
instead of std::cerr
for both a missing signer and failure to sign.