Merge 4f1a75b1aa into merged_master (Bitcoin PR bitcoin/bitcoin#22621)

This commit is contained in:
Byron Hambly 2023-04-06 13:59:37 +00:00
commit 1d89a2fdfa
7 changed files with 40 additions and 36 deletions

View file

@ -27,6 +27,7 @@
#include <util/strencodings.h>
#include <util/system.h>
#include <optional>
#include <stdint.h>
#include <tuple>
#ifdef HAVE_MALLOC_INFO
@ -164,12 +165,13 @@ static RPCHelpMan createmultisig()
// Get the output type
OutputType output_type = OutputType::LEGACY;
if (!request.params[2].isNull()) {
if (!ParseOutputType(request.params[2].get_str(), output_type)) {
std::optional<OutputType> parsed = ParseOutputType(request.params[2].get_str());
if (!parsed) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, strprintf("Unknown address type '%s'", request.params[2].get_str()));
}
if (output_type == OutputType::BECH32M) {
} else if (parsed.value() == OutputType::BECH32M) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "createmultisig cannot create bech32m multisig addresses");
}
output_type = parsed.value();
}
// Construct using pay-to-script-hash: