@@ -1169,9 +1169,8 @@ UniValue addmultisigaddress(const JSONRPCRequest& request)
1169
1169
return NullUniValue;
1170
1170
}
1171
1171
1172
- if (request.fHelp || request.params .size () < 2 || request.params .size () > 3 )
1173
- {
1174
- std::string msg = " addmultisigaddress nrequired [\" key\" ,...] ( \" account\" )\n "
1172
+ if (request.fHelp || request.params .size () < 2 || request.params .size () > 4 ) {
1173
+ std::string msg = " addmultisigaddress nrequired [\" key\" ,...] ( \" account\" \" address_type\" )\n "
1175
1174
" \n Add a nrequired-to-sign multisignature address to the wallet. Requires a new wallet backup.\n "
1176
1175
" Each key is a Bitcoin address or hex-encoded public key.\n "
1177
1176
" This functionality is only intended for use with non-watchonly addresses.\n "
@@ -1186,6 +1185,7 @@ UniValue addmultisigaddress(const JSONRPCRequest& request)
1186
1185
" ...,\n "
1187
1186
" ]\n "
1188
1187
" 3. \" account\" (string, optional) DEPRECATED. An account to assign the addresses to.\n "
1188
+ " 4. \" address_type\" (string, optional) The address type to use. Options are \" legacy\" , \" p2sh-segwit\" , and \" bech32\" . Default is set by -addresstype.\n "
1189
1189
1190
1190
" \n Result:\n "
1191
1191
" {\n "
@@ -1224,10 +1224,18 @@ UniValue addmultisigaddress(const JSONRPCRequest& request)
1224
1224
}
1225
1225
}
1226
1226
1227
+ OutputType output_type = g_address_type;
1228
+ if (!request.params [3 ].isNull ()) {
1229
+ output_type = ParseOutputType (request.params [3 ].get_str (), output_type);
1230
+ if (output_type == OUTPUT_TYPE_NONE) {
1231
+ throw JSONRPCError (RPC_INVALID_ADDRESS_OR_KEY, strprintf (" Unknown address type '%s'" , request.params [3 ].get_str ()));
1232
+ }
1233
+ }
1234
+
1227
1235
// Construct using pay-to-script-hash:
1228
1236
CScript inner = CreateMultisigRedeemscript (required, pubkeys);
1229
1237
pwallet->AddCScript (inner);
1230
- CTxDestination dest = pwallet->AddAndGetDestinationForScript (inner, g_address_type );
1238
+ CTxDestination dest = pwallet->AddAndGetDestinationForScript (inner, output_type );
1231
1239
pwallet->SetAddressBook (dest, strAccount, " send" );
1232
1240
1233
1241
// Return old style interface
@@ -3077,7 +3085,7 @@ UniValue fundrawtransaction(const JSONRPCRequest& request)
3077
3085
" for backward compatibility: passing in a true instead of an object will result in {\" includeWatching\" :true}\n "
3078
3086
" 3. iswitness (boolean, optional) Whether the transaction hex is a serialized witness transaction \n "
3079
3087
" If iswitness is not present, heuristic tests will be used in decoding\n "
3080
-
3088
+
3081
3089
" \n Result:\n "
3082
3090
" {\n "
3083
3091
" \" hex\" : \" value\" , (string) The resulting raw transaction (hex-encoded string)\n "
@@ -3519,7 +3527,7 @@ static const CRPCCommand commands[] =
3519
3527
{ " hidden" , " resendwallettransactions" , &resendwallettransactions, {} },
3520
3528
{ " wallet" , " abandontransaction" , &abandontransaction, {" txid" } },
3521
3529
{ " wallet" , " abortrescan" , &abortrescan, {} },
3522
- { " wallet" , " addmultisigaddress" , &addmultisigaddress, {" nrequired" ," keys" ," account" } },
3530
+ { " wallet" , " addmultisigaddress" , &addmultisigaddress, {" nrequired" ," keys" ," account" , " address_type " } },
3523
3531
{ " hidden" , " addwitnessaddress" , &addwitnessaddress, {" address" ," p2sh" } },
3524
3532
{ " wallet" , " backupwallet" , &backupwallet, {" destination" } },
3525
3533
{ " wallet" , " bumpfee" , &bumpfee, {" txid" , " options" } },
0 commit comments