This is to track the regression introduced in master, which needs fixing for 0.14. See #9240, #9371, etc.
{
    LOCK(cs_wallet);
    CWalletDB walletdb(strWalletFile, "r+", fFlushOnClose);
    uint256 hash = wtxIn.GetHash();
    
    pair<map<uint256, CWalletTx>::iterator, bool> ret = mapWallet.insert(make_pair(hash, wtxIn));
    CWalletTx& wtx = (*ret.first).second;
    wtx.BindWallet(this);
    bool fInsertedNew = ret.second;
    if (fInsertedNew)
    {
        wtx.nTimeReceived = GetAdjustedTime();
        wtx.nOrderPos = IncOrderPosNext(&walletdb);
        wtxOrdered.insert(make_pair(wtx.nOrderPos, TxPair(&wtx, (CAccountingEntry*)0)));
        wtx.nTimeSmart = wtx.nTimeReceived;