diff options
author | Sjors Provoost <sjors@sprovoost.nl> | 2024-02-13 13:25:59 +0100 |
---|---|---|
committer | Sjors Provoost <sjors@sprovoost.nl> | 2024-04-16 17:47:43 +0200 |
commit | 4357158c4712d479522d5cd441ad4dd1693fdd05 (patch) | |
tree | e53759850827b1275022fe3ea96a405dfd7226d6 /src/wallet/rpc/addresses.cpp | |
parent | dc55531087478d01fbde4f5fbb75375b672960c3 (diff) | |
download | bitcoin-4357158c4712d479522d5cd441ad4dd1693fdd05.tar.xz |
wallet: return and display signer error
Both RPC and GUI now render a useful error message instead of (silently) failing.
Replace bool with util::Result<void> to clarify that this either succeeds or returns an error message.
Diffstat (limited to 'src/wallet/rpc/addresses.cpp')
-rw-r--r-- | src/wallet/rpc/addresses.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/wallet/rpc/addresses.cpp b/src/wallet/rpc/addresses.cpp index 7f068c05ef..bed9ec029a 100644 --- a/src/wallet/rpc/addresses.cpp +++ b/src/wallet/rpc/addresses.cpp @@ -789,9 +789,8 @@ RPCHelpMan walletdisplayaddress() throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid address"); } - if (!pwallet->DisplayAddress(dest)) { - throw JSONRPCError(RPC_MISC_ERROR, "Failed to display address"); - } + util::Result<void> res = pwallet->DisplayAddress(dest); + if (!res) throw JSONRPCError(RPC_MISC_ERROR, util::ErrorString(res).original); UniValue result(UniValue::VOBJ); result.pushKV("address", request.params[0].get_str()); |