addmultisigaddress creates an address respecting the setting, being unable to generate a specific type of address without also adding it to the wallet seems wrong.

I suppose in the future `addresstype` may be refactored to be wallet-specific, which would leave this non-wallet rpc call without an argument. Perhaps there should just be an optional parameter to set it.
{
    {
        LOCK(cs_wallet);
        for (std::pair<const uint256, CWalletTx>& item : mapWallet)
            item.second.MarkDirty();
    }
}
bool CWallet::MarkReplaced(const uint256& originalHash, const uint256& newHash)
{
    LOCK(cs_wallet);
    auto mi = mapWallet.find(originalHash);
    
    assert(mi != mapWallet.end());
    CWalletTx& wtx = (*mi).second;
    
    assert(wtx.mapValue.count("replaced_by_txid") == 0);
    wtx.mapValue["replaced_by_txid"] = newHash.ToString();
    WalletBatch batch(*database, "r+");
    bool success = true;
    if (!batch.WriteTx(wtx)) {
        LogPrintf("%s: Updating batch tx %s failed\n", __func__, wtx.GetHash().ToString());
        success = false;
    }
    NotifyTransactionChanged(this, originalHash, CT_UPDATED);
    return success;
}
bool CWallet::AddToWallet(const CWalletTx& wtxIn, bool fFlushOnClose)