diff options
author | MarcoFalke <falke.marco@gmail.com> | 2021-12-11 09:41:20 +0100 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2021-12-11 09:41:25 +0100 |
commit | ac92ab6da58e34993d0641b98eef5b5f55b6cbf9 (patch) | |
tree | 81cb5432b9e9697f607e907c78cb922b7e8e5ad6 /src/wallet | |
parent | 90deb9f980d02b9ca4000a78baa2beb15a5f1bbd (diff) | |
parent | d5cab1a96d26e66d342fb5ec35c809bb82869d00 (diff) |
Merge bitcoin/bitcoin#23113: Add warnings to createmultisig and addmultisig if using uncompressed keys
d5cab1a96d26e66d342fb5ec35c809bb82869d00 Add createmultisig and addmultisigaddress warnings release note (Samuel Dobson)
e46fc935aa6eb392ef9411dad310697aba601f6a Add warnings field to addmultisigaddress to warn about uncompressed keys (Samuel Dobson)
d1a9742623e2a8f3307c84c2df6993f62617a6f6 Add warnings field to createmultisig to warn about uncompressed keys (Samuel Dobson)
Pull request description:
Fixes #21368
Currently, if there are any uncompressed keys when calling `AddAndGetMultisigDestination`, it will just default to a legacy address regardless of the chosen `address_type`. Rather than keeping this silent behaviour which may be confusing to users, we explicitly add a `warnings` field which will warn the user why their address format is different.
ACKs for top commit:
achow101:
ACK d5cab1a96d26e66d342fb5ec35c809bb82869d00
Tree-SHA512: c2ac7f7689251bd4fcd8c26506f053921fbaf34c7a26a74e82ebc7f82cc0bd25407fd7954bf98365dcafa51fa45dcdbee6214320580ca69509690c3555e71cc0
Diffstat (limited to 'src/wallet')
-rw-r--r-- | src/wallet/rpc/addresses.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/wallet/rpc/addresses.cpp b/src/wallet/rpc/addresses.cpp index e570c18099..c7400cafe7 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; }, }; |