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, ...).

{
    std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
    CWallet* const pwallet = wallet.get();
    if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
        return NullUniValue;
    }
    if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) {
        throw std::runtime_error(
            "generate nblocks ( maxtries )\n"
            "\nMine up to nblocks blocks immediately (before the RPC call returns) to an address in the wallet.\n"
            "\nArguments:\n"
            "1. nblocks      (numeric, required) How many blocks are generated immediately.\n"
            "2. maxtries     (numeric, optional) How many iterations to try (default = 1000000).\n"
            "\nResult:\n"
            "[ blockhashes ]     (array) hashes of blocks generated\n"
            "\nExamples:\n"
            "\nGenerate 11 blocks\n"
            + HelpExampleCli("generate", "11")
        );
    }
    int num_generate = request.params[0].get_int();
    uint64_t max_tries = 1000000;
    if (!request.params[1].isNull()) {
        max_tries = request.params[1].get_int();
    }
    std::shared_ptr<CReserveScript> coinbase_script;