aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/rpc/addresses.cpp
diff options
context:
space:
mode:
authorSamuel Dobson <dobsonsa68@gmail.com>2021-12-08 17:05:16 +1300
committerSamuel Dobson <dobsonsa68@gmail.com>2021-12-08 17:14:40 +1300
commite46fc935aa6eb392ef9411dad310697aba601f6a (patch)
tree980de14a82773d0570876d25e4d01e283ace47fe /src/wallet/rpc/addresses.cpp
parentd1a9742623e2a8f3307c84c2df6993f62617a6f6 (diff)
Add warnings field to addmultisigaddress to warn about uncompressed keys
Diffstat (limited to 'src/wallet/rpc/addresses.cpp')
-rw-r--r--src/wallet/rpc/addresses.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/wallet/rpc/addresses.cpp b/src/wallet/rpc/addresses.cpp
index edc4c26eeb..3c07354e80 100644
--- a/src/wallet/rpc/addresses.cpp
+++ b/src/wallet/rpc/addresses.cpp
@@ -238,6 +238,10 @@ RPCHelpMan addmultisigaddress()
{RPCResult::Type::STR, "address", "The value of the new multisig address"},
{RPCResult::Type::STR_HEX, "redeemScript", "The string value of the hex-encoded redemption script"},
{RPCResult::Type::STR, "descriptor", "The descriptor for this multisig"},
+ {RPCResult::Type::ARR, "warnings", /* optional */ true, "Any warnings resulting from the creation of this multisig",
+ {
+ {RPCResult::Type::STR, "", ""},
+ }},
}
},
RPCExamples{
@@ -295,6 +299,14 @@ RPCHelpMan addmultisigaddress()
result.pushKV("address", EncodeDestination(dest));
result.pushKV("redeemScript", HexStr(inner));
result.pushKV("descriptor", descriptor->ToString());
+
+ UniValue warnings(UniValue::VARR);
+ if (!request.params[3].isNull() && OutputTypeFromDestination(dest) != 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);
+
return result;
},
};