Some comments from @sipa in #12702.

___

Yes, I think `importmulti` is superior in every way, except:
* Slightly less convenient to use (it requires redundant information, as you have to explicitly state what you want to import, and then give the keys/... to enable that).
* ~Doesn't support P2SH-P2WPKH yet~. Added in #14454

The latter can be fixed by just adding support for that case. The former can be improved by adding 'default' cases (e.g. if you prove a WIF private key, it can permit omitting the address, ...).

}
            CPubKey pubKey = key.GetPubKey();
            assert(key.VerifyPubKey(pubKey));
            CKeyID vchAddress = pubKey.GetID();
            pwallet->MarkDirty();
            if (pwallet->HaveKey(vchAddress)) {
                throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Already have this key");
            }
            pwallet->mapKeyMetadata[vchAddress].nCreateTime = timestamp;
            if (!pwallet->AddKeyPubKey(key, pubKey)) {
                throw JSONRPCError(RPC_WALLET_ERROR, "Error adding key to wallet");
            }
            pwallet->UpdateTimeFirstKey(timestamp);
        }
        UniValue result = UniValue(UniValue::VOBJ);
        result.pushKV("success", UniValue(true));
        return result;
    } catch (const UniValue& e) {
        UniValue result = UniValue(UniValue::VOBJ);
        result.pushKV("success", UniValue(false));
        result.pushKV("error", e);
        return result;
    } catch (...) {
        UniValue result = UniValue(UniValue::VOBJ);
        result.pushKV("success", UniValue(false));
        result.pushKV("error", JSONRPCError(RPC_MISC_ERROR, "Missing required fields"));
        return result;
    }
}
static int64_t GetImportTimestamp(const UniValue& data, int64_t now)