From 0a4ee93529d68a31f3ba6c7c6009954be47bbbd6 Mon Sep 17 00:00:00 2001 From: Sjors Provoost Date: Thu, 5 Jun 2025 11:46:08 +0200 Subject: [PATCH] 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. --- src/wallet/external_signer_scriptpubkeyman.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/wallet/external_signer_scriptpubkeyman.cpp b/src/wallet/external_signer_scriptpubkeyman.cpp index 5ffc802ec1..c2b1b6048a 100644 --- a/src/wallet/external_signer_scriptpubkeyman.cpp +++ b/src/wallet/external_signer_scriptpubkeyman.cpp @@ -94,11 +94,14 @@ std::optional 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