@@ -142,7 +142,7 @@ RPCHelpMan importprivkey()
142
142
std::string strSecret = request.params [0 ].get_str ();
143
143
std::string strLabel;
144
144
if (!request.params [1 ].isNull ())
145
- strLabel = request.params [1 ]. get_str ( );
145
+ strLabel = LabelFromValue ( request.params [1 ]);
146
146
147
147
// Whether to perform rescan after import
148
148
if (!request.params [2 ].isNull ())
@@ -235,7 +235,7 @@ RPCHelpMan importaddress()
235
235
236
236
std::string strLabel;
237
237
if (!request.params [1 ].isNull ())
238
- strLabel = request.params [1 ]. get_str ( );
238
+ strLabel = LabelFromValue ( request.params [1 ]);
239
239
240
240
// Whether to perform rescan after import
241
241
bool fRescan = true ;
@@ -428,7 +428,7 @@ RPCHelpMan importpubkey()
428
428
429
429
std::string strLabel;
430
430
if (!request.params [1 ].isNull ())
431
- strLabel = request.params [1 ]. get_str ( );
431
+ strLabel = LabelFromValue ( request.params [1 ]);
432
432
433
433
// Whether to perform rescan after import
434
434
bool fRescan = true ;
@@ -1163,7 +1163,7 @@ static UniValue ProcessImport(CWallet& wallet, const UniValue& data, const int64
1163
1163
if (internal && data.exists (" label" )) {
1164
1164
throw JSONRPCError (RPC_INVALID_PARAMETER, " Internal addresses should not have a label" );
1165
1165
}
1166
- const std::string& label = data.exists (" label" ) ? data[" label" ]. get_str ( ) : " " ;
1166
+ const std::string& label = data.exists (" label" ) ? LabelFromValue ( data[" label" ]) : " " ;
1167
1167
const bool add_keypool = data.exists (" keypool" ) ? data[" keypool" ].get_bool () : false ;
1168
1168
1169
1169
// Add to keypool only works with privkeys disabled
@@ -1457,7 +1457,7 @@ static UniValue ProcessDescriptorImport(CWallet& wallet, const UniValue& data, c
1457
1457
const std::string& descriptor = data[" desc" ].get_str ();
1458
1458
const bool active = data.exists (" active" ) ? data[" active" ].get_bool () : false ;
1459
1459
const bool internal = data.exists (" internal" ) ? data[" internal" ].get_bool () : false ;
1460
- const std::string& label = data.exists (" label" ) ? data[" label" ]. get_str ( ) : " " ;
1460
+ const std::string& label = data.exists (" label" ) ? LabelFromValue ( data[" label" ]) : " " ;
1461
1461
1462
1462
// Parse descriptor string
1463
1463
FlatSigningProvider keys;
0 commit comments