wallet: use PSBTError::EXTERNAL_SIGNER_NOT_FOUND
Instead of throwing a runtime error, let the caller decide how to handle a missing signer. GUI code was already in place to handle this, but it was unused until this commit. Fixes #32426 Additionally use LogWarning instead of std::cerr.
This commit is contained in:
1 file changed
+5
-2
@@ -94,11 +94,14 @@ std::optional<PSBTError> ExternalSignerScriptPubKeyMan::FillPSBT(PartiallySigned
|
|||||||
if (complete) return {};
|
if (complete) return {};
|
||||||
|
|
||||||
auto signer{GetExternalSigner()};
|
auto signer{GetExternalSigner()};
|
||||||
if (!signer) throw std::runtime_error(util::ErrorString(signer).original);
|
if (!signer) {
|
||||||
|
LogWarning("%s", util::ErrorString(signer).original);
|
||||||
|
return PSBTError::EXTERNAL_SIGNER_NOT_FOUND;
|
||||||
|
}
|
||||||
|
|
||||||
std::string failure_reason;
|
std::string failure_reason;
|
||||||
if(!signer->SignTransaction(psbt, failure_reason)) {
|
if(!signer->SignTransaction(psbt, failure_reason)) {
|
||||||
tfm::format(std::cerr, "Failed to sign: %s\n", failure_reason);
|
LogWarning("Failed to sign: %s\n", failure_reason);
|
||||||
return PSBTError::EXTERNAL_SIGNER_FAILED;
|
return PSBTError::EXTERNAL_SIGNER_FAILED;
|
||||||
}
|
}
|
||||||
if (finalize) FinalizePSBT(psbt); // This won't work in a multisig setup
|
if (finalize) FinalizePSBT(psbt); // This won't work in a multisig setup
|
||||||
|
|||||||
Reference in new issue
Block a user