int LimitOrphanTxSize(int nMaxOrphans)
{
    int nEvicted = 0;
    while (mapOrphanTransactions.size() > nMaxOrphans)
    {
        // Evict a random orphan:
        std::vector<unsigned char> randbytes(32);
        RAND_bytes(&randbytes[0], 32);
        uint256 randomhash(randbytes);
        map<uint256, CDataStream*>::iterator it = mapOrphanTransactions.lower_bound(randomhash);
        if (it == mapOrphanTransactions.end())
            it = mapOrphanTransactions.begin();
        EraseOrphanTx(it->first);
        ++nEvicted;
    }
    return nEvicted;
}
int LimitOrphanTxSize(int nMaxOrphans)
{
    int nEvicted = 0;
    while (mapOrphanTransactions.size() > nMaxOrphans)
    {
         
        std::vector<unsigned char> randbytes(32);
        RAND_bytes(&randbytes[0], 32);
        uint256 randomhash(randbytes);
        map<uint256, CDataStream*>::iterator it = mapOrphanTransactions.lower_bound(randomhash);
        if (it == mapOrphanTransactions.end())
            it = mapOrphanTransactions.begin();
        EraseOrphanTx(it->first);
        ++nEvicted;
    }
    return nEvicted;
}