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

int target_confirms = 1;
    isminefilter filter = ISMINE_SPENDABLE;
    if (!request.params[0].isNull() && !request.params[0].get_str().empty()) {
        uint256 blockId(ParseHashV(request.params[0], "blockhash"));
        paltindex = pindex = LookupBlockIndex(blockId);
        if (!pindex) {
            throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found");
        }
        if (chainActive[pindex->nHeight] != pindex) {
            
            
            
            pindex = chainActive.FindFork(pindex);
        }
    }
    if (!request.params[1].isNull()) {
        target_confirms = request.params[1].get_int();
        if (target_confirms < 1) {
            throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter");
        }
    }
    if (!request.params[2].isNull() && request.params[2].get_bool()) {
        filter = filter | ISMINE_WATCH_ONLY;
    }
    bool include_removed = (request.params[3].isNull() || request.params[3].get_bool());
    int depth = pindex ? (1 + chainActive.Height() - pindex->nHeight) : -1;
    UniValue transactions(UniValue::VARR);
    for (const std::pair<const uint256, CWalletTx>& pairWtx : pwallet->mapWallet) {
        CWalletTx tx = pairWtx.second;
        if (depth == -1 || tx.GetDepthInMainChain() < depth) {