From eaf6f630c0190c634b5f1c85f749437f4209cc36 Mon Sep 17 00:00:00 2001 From: brunoerg Date: Wed, 25 May 2022 15:16:22 -0300 Subject: rpc: fix inappropriate warning for address type p2sh-segwit in createmultisig and addmultisigaddress --- src/rpc/output_script.cpp | 4 ++-- src/wallet/rpc/addresses.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/rpc/output_script.cpp b/src/rpc/output_script.cpp index 115a656e12..f4bb76f50f 100644 --- a/src/rpc/output_script.cpp +++ b/src/rpc/output_script.cpp @@ -163,11 +163,11 @@ static RPCHelpMan createmultisig() result.pushKV("descriptor", descriptor->ToString()); UniValue warnings(UniValue::VARR); - if (!request.params[2].isNull() && OutputTypeFromDestination(dest) != output_type) { + if (descriptor->GetOutputType() != output_type) { // Only warns if the user has explicitly chosen an address type we cannot generate warnings.push_back("Unable to make chosen address type, please ensure no uncompressed public keys are present."); } - if (warnings.size()) result.pushKV("warnings", warnings); + if (!warnings.empty()) result.pushKV("warnings", warnings); return result; }, diff --git a/src/wallet/rpc/addresses.cpp b/src/wallet/rpc/addresses.cpp index d5444f5051..f25ad59528 100644 --- a/src/wallet/rpc/addresses.cpp +++ b/src/wallet/rpc/addresses.cpp @@ -302,11 +302,11 @@ RPCHelpMan addmultisigaddress() result.pushKV("descriptor", descriptor->ToString()); UniValue warnings(UniValue::VARR); - if (!request.params[3].isNull() && OutputTypeFromDestination(dest) != output_type) { + if (descriptor->GetOutputType() != output_type) { // Only warns if the user has explicitly chosen an address type we cannot generate warnings.push_back("Unable to make chosen address type, please ensure no uncompressed public keys are present."); } - if (warnings.size()) result.pushKV("warnings", warnings); + if (!warnings.empty()) result.pushKV("warnings", warnings); return result; }, -- cgit v1.2.3