Skip to content

Commit 273d025

Browse files
committed
Use a FastRandomContext in LimitOrphanTxSize
1 parent 3db746b commit 273d025

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/net_processing.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -779,10 +779,11 @@ unsigned int LimitOrphanTxSize(unsigned int nMaxOrphans)
779779
nNextSweep = nMinExpTime + ORPHAN_TX_EXPIRE_INTERVAL;
780780
if (nErased > 0) LogPrint(BCLog::MEMPOOL, "Erased %d orphan tx due to expiration\n", nErased);
781781
}
782+
FastRandomContext rng;
782783
while (mapOrphanTransactions.size() > nMaxOrphans)
783784
{
784785
// Evict a random orphan:
785-
uint256 randomhash = GetRandHash();
786+
uint256 randomhash = rng.rand256();
786787
std::map<uint256, COrphanTx>::iterator it = mapOrphanTransactions.lower_bound(randomhash);
787788
if (it == mapOrphanTransactions.end())
788789
it = mapOrphanTransactions.begin();

0 commit comments

Comments
 (0)