https://cirrus-ci.com/task/5603470202896384?logs=ci#L2681
auto it = mapWallet.find(txin.prevout.hash);
        if (it != mapWallet.end()) {
            it->second.MarkDirty();
        }
    }
}
bool CWalletAbandonTransaction(const uint256& hashTx)
{
    LOCK(cs_);
    WalletBatch batch(GetDatabase());
    stdset<uint256> todo;
    stdset<uint256> done;
    // C
    auto it = mapWallet.find(hashTx);
    assert(it != mapWallet.end());
    const CWalletTx& origtx = it->second;
    if (GetTxDepthInMainChain(origtx) != 0 || origtx.InMempool()) {
        return false;
    }
    todo.insert(hashTx);
    while (!todo.empty()) {
        uint256 now = *todo.begin();
        todo.erase(now);
        done.insert(now);
        auto it = mapWallet.find(now);
        assert(it != mapWallet.end());
        CWalletTx& wtx = it->second;
        int currentconfirm = GetTxDepthInMainChain(wtx);
        // I
        assert(currentconfirm <= 0);