@@ -471,7 +471,7 @@ RPCHelpMan importpubkey()
471
471
472
472
pwallet->ImportScriptPubKeys (strLabel, script_pub_keys, /* have_solving_data=*/ true , /* apply_label=*/ true , /* timestamp=*/ 1 );
473
473
474
- pwallet->ImportPubKeys ({pubKey.GetID ()} , {{pubKey.GetID (), pubKey}} , /* key_origins=*/ {}, /* add_keypool= */ false , /* internal =*/ false , /* timestamp=*/ 1 );
474
+ pwallet->ImportPubKeys ({{ pubKey.GetID (), false }} , {{pubKey.GetID (), pubKey}} , /* key_origins=*/ {}, /* add_keypool=*/ false , /* timestamp=*/ 1 );
475
475
}
476
476
if (fRescan )
477
477
{
@@ -915,7 +915,7 @@ static std::string RecurseImportData(const CScript& script, ImportData& import_d
915
915
NONFATAL_UNREACHABLE ();
916
916
}
917
917
918
- static UniValue ProcessImportLegacy (ImportData& import_data, std::map<CKeyID, CPubKey>& pubkey_map, std::map<CKeyID, CKey>& privkey_map, std::set<CScript>& script_pub_keys, bool & have_solving_data, const UniValue& data, std::vector<CKeyID>& ordered_pubkeys)
918
+ static UniValue ProcessImportLegacy (ImportData& import_data, std::map<CKeyID, CPubKey>& pubkey_map, std::map<CKeyID, CKey>& privkey_map, std::set<CScript>& script_pub_keys, bool & have_solving_data, const UniValue& data, std::vector<std::pair< CKeyID, bool > >& ordered_pubkeys)
919
919
{
920
920
UniValue warnings (UniValue::VARR);
921
921
@@ -981,7 +981,7 @@ static UniValue ProcessImportLegacy(ImportData& import_data, std::map<CKeyID, CP
981
981
for (size_t i = 0 ; i < pubKeys.size (); ++i) {
982
982
CPubKey pubkey = HexToPubKey (pubKeys[i].get_str ());
983
983
pubkey_map.emplace (pubkey.GetID (), pubkey);
984
- ordered_pubkeys.push_back (pubkey.GetID ());
984
+ ordered_pubkeys.emplace_back (pubkey.GetID (), internal );
985
985
}
986
986
for (size_t i = 0 ; i < keys.size (); ++i) {
987
987
const auto & str = keys[i].get_str ();
@@ -1054,8 +1054,10 @@ static UniValue ProcessImportLegacy(ImportData& import_data, std::map<CKeyID, CP
1054
1054
return warnings;
1055
1055
}
1056
1056
1057
- static UniValue ProcessImportDescriptor (ImportData& import_data, std::map<CKeyID, CPubKey>& pubkey_map, std::map<CKeyID, CKey>& privkey_map, std::set<CScript>& script_pub_keys, bool & have_solving_data, const UniValue& data, std::vector<CKeyID>& ordered_pubkeys)
1057
+ static UniValue ProcessImportDescriptor (ImportData& import_data, std::map<CKeyID, CPubKey>& pubkey_map, std::map<CKeyID, CKey>& privkey_map, std::set<CScript>& script_pub_keys, bool & have_solving_data, const UniValue& data, std::vector<std::pair< CKeyID, bool > >& ordered_pubkeys)
1058
1058
{
1059
+ const bool internal = data.exists (" internal" ) ? data[" internal" ].get_bool () : false ;
1060
+
1059
1061
UniValue warnings (UniValue::VARR);
1060
1062
1061
1063
const std::string& descriptor = data[" desc" ].get_str ();
@@ -1092,7 +1094,7 @@ static UniValue ProcessImportDescriptor(ImportData& import_data, std::map<CKeyID
1092
1094
parsed_desc->Expand (i, keys, scripts_temp, out_keys);
1093
1095
std::copy (scripts_temp.begin (), scripts_temp.end (), std::inserter (script_pub_keys, script_pub_keys.end ()));
1094
1096
for (const auto & key_pair : out_keys.pubkeys ) {
1095
- ordered_pubkeys.push_back (key_pair.first );
1097
+ ordered_pubkeys.emplace_back (key_pair.first , internal );
1096
1098
}
1097
1099
1098
1100
for (const auto & x : out_keys.scripts ) {
@@ -1167,7 +1169,7 @@ static UniValue ProcessImport(CWallet& wallet, const UniValue& data, const int64
1167
1169
std::map<CKeyID, CPubKey> pubkey_map;
1168
1170
std::map<CKeyID, CKey> privkey_map;
1169
1171
std::set<CScript> script_pub_keys;
1170
- std::vector<CKeyID> ordered_pubkeys;
1172
+ std::vector<std::pair< CKeyID, bool > > ordered_pubkeys;
1171
1173
bool have_solving_data;
1172
1174
1173
1175
if (data.exists (" scriptPubKey" ) && data.exists (" desc" )) {
@@ -1200,7 +1202,7 @@ static UniValue ProcessImport(CWallet& wallet, const UniValue& data, const int64
1200
1202
if (!wallet.ImportPrivKeys (privkey_map, timestamp)) {
1201
1203
throw JSONRPCError (RPC_WALLET_ERROR, " Error adding key to wallet" );
1202
1204
}
1203
- if (!wallet.ImportPubKeys (ordered_pubkeys, pubkey_map, import_data.key_origins , add_keypool, internal, timestamp)) {
1205
+ if (!wallet.ImportPubKeys (ordered_pubkeys, pubkey_map, import_data.key_origins , add_keypool, timestamp)) {
1204
1206
throw JSONRPCError (RPC_WALLET_ERROR, " Error adding address to wallet" );
1205
1207
}
1206
1208
if (!wallet.ImportScriptPubKeys (label, script_pub_keys, have_solving_data, !internal, timestamp)) {
0 commit comments