You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"\nAdd an nrequired-to-sign multisignature address to the wallet. Requires a new wallet backup.\n"
222
-
"Each key is a Bitcoin address or hex-encoded public key.\n"
223
-
"This functionality is only intended for use with non-watchonly addresses.\n"
224
-
"See `importaddress` for watchonly p2sh address support.\n"
225
-
"If 'label' is specified, assign address to that label.\n"
226
-
"Note: This command is only compatible with legacy wallets.\n",
227
-
{
228
-
{"nrequired", RPCArg::Type::NUM, RPCArg::Optional::NO, "The number of required signatures out of the n keys or addresses."},
229
-
{"keys", RPCArg::Type::ARR, RPCArg::Optional::NO, "The bitcoin addresses or hex-encoded public keys",
230
-
{
231
-
{"key", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "bitcoin address or hex-encoded public key"},
232
-
},
233
-
},
234
-
{"label", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "A label to assign the addresses to."},
235
-
{"address_type", RPCArg::Type::STR, RPCArg::DefaultHint{"set by -addresstype"}, "The address type to use. Options are \"legacy\", \"p2sh-segwit\", and \"bech32\"."},
236
-
},
237
-
RPCResult{
238
-
RPCResult::Type::OBJ, "", "",
239
-
{
240
-
{RPCResult::Type::STR, "address", "The value of the new multisig address"},
241
-
{RPCResult::Type::STR_HEX, "redeemScript", "The string value of the hex-encoded redemption script"},
242
-
{RPCResult::Type::STR, "descriptor", "The descriptor for this multisig"},
243
-
{RPCResult::Type::ARR, "warnings", /*optional=*/true, "Any warnings resulting from the creation of this multisig",
throwJSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Bech32m multisig addresses cannot be created with legacy wallets");
286
-
}
287
-
output_type = parsed.value();
288
-
}
289
-
290
-
// Construct multisig scripts
291
-
FlatSigningProvider provider;
292
-
CScript inner;
293
-
CTxDestination dest = AddAndGetMultisigDestination(required, pubkeys, output_type, provider, inner);
294
-
295
-
// Import scripts into the wallet
296
-
for (constauto& [id, script] : provider.scripts) {
297
-
// Due to a bug in the legacy wallet, the p2sh maximum script size limit is also imposed on 'p2sh-segwit' and 'bech32' redeem scripts.
298
-
// Even when redeem scripts over MAX_SCRIPT_ELEMENT_SIZE bytes are valid for segwit output types, we don't want to
299
-
// enable it because:
300
-
// 1) It introduces a compatibility-breaking change requiring downgrade protection; older wallets would be unable to interact with these "new" legacy wallets.
301
-
// 2) Considering the ongoing deprecation of the legacy spkm, this issue adds another good reason to transition towards descriptors.
302
-
if (script.size() > MAX_SCRIPT_ELEMENT_SIZE) throwJSONRPCError(RPC_WALLET_ERROR, "Unsupported multisig script size for legacy wallet. Upgrade to descriptors to overcome this limitation for p2sh-segwit or bech32 scripts");
303
-
304
-
if (!spk_man.AddCScript(script)) {
305
-
if (CScript inner_script; spk_man.GetCScript(CScriptID(script), inner_script)) {
306
-
CHECK_NONFATAL(inner_script == script); // Nothing to add, script already contained by the wallet
307
-
continue;
308
-
}
309
-
throwJSONRPCError(RPC_WALLET_ERROR, strprintf("Error importing script into the wallet"));
0 commit comments