diff --git a/src/wallet/rpcdump.cpp b/src/wallet/rpcdump.cpp index 8ed912ed1..5ceba3970 100644 --- a/src/wallet/rpcdump.cpp +++ b/src/wallet/rpcdump.cpp @@ -888,6 +888,7 @@ struct ImportData // Output data std::set import_scripts; std::map used_keys; //!< Import these private keys if available (the value indicates whether if the key is required for solvability) + std::map key_origins; }; enum class ScriptContext @@ -1158,7 +1159,7 @@ static UniValue ProcessImportDescriptor(ImportData& import_data, std::mapGetPubKey(id, temp) && !pwallet->AddWatchOnly(GetScriptForRawPubKey(pubkey), timestamp)) { throw JSONRPCError(RPC_WALLET_ERROR, "Error adding address to wallet"); } + const auto& key_orig_it = import_data.key_origins.find(id); + if (key_orig_it != import_data.key_origins.end()) { + pwallet->AddKeyOrigin(pubkey, key_orig_it->second); + } + pwallet->mapKeyMetadata[id].nCreateTime = timestamp; } for (const CScript& script : script_pub_keys) {