https://travis-ci.org/github/bitcoin/bitcoin/jobs/680452476#L6107
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
    if (!wallet) return NullUniValue;
    CWallet* const pwallet = wallet.get();
    EnsureLegacyScriptPubKeyMan(*pwallet, true);
    std::string strLabel;
    if (!request.params[1].isNull())
        strLabel = request.params[1].get_str();
    
    bool fRescan = true;
    if (!request.params[2].isNull())
        fRescan = request.params[2].get_bool();
    if (fRescan && pwallet->chain().havePruned()) {
        
        
        
        throw JSONRPCError(RPC_WALLET_ERROR, "Rescan is disabled when blocks are pruned");
    }
    WalletRescanReserver reserver(*pwallet);
    if (fRescan && !reserver.reserve()) {
        throw JSONRPCError(RPC_WALLET_ERROR, "Wallet is currently rescanning. Abort existing rescan or wait.");
    }
    
    bool fP2SH = false;
    if (!request.params[3].isNull())
        fP2SH = request.params[3].get_bool();
    {
        LOCK(pwallet->cs_wallet);
        CTxDestination dest = DecodeDestination(request.params[0].get_str());
        if (IsValidDestination(dest)) {
            if (fP2SH) {