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:
Sjors Provoost
2025-06-05 11:46:08 +02:00
parent 8ba2f9b7c8
commit 0a4ee93529

View File

@@ -94,11 +94,14 @@ std::optional<PSBTError> ExternalSignerScriptPubKeyMan::FillPSBT(PartiallySigned
if (complete) return {};
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;
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;
}
if (finalize) FinalizePSBT(psbt); // This won't work in a multisig setup