From 273d02580aa736b7ccea8fce51d90541665fdbd1 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Wed, 31 Oct 2018 15:05:42 -0700 Subject: [PATCH] Use a FastRandomContext in LimitOrphanTxSize --- src/net_processing.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 40c51125781..0e222bdfa47 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -779,10 +779,11 @@ unsigned int LimitOrphanTxSize(unsigned int nMaxOrphans) nNextSweep = nMinExpTime + ORPHAN_TX_EXPIRE_INTERVAL; if (nErased > 0) LogPrint(BCLog::MEMPOOL, "Erased %d orphan tx due to expiration\n", nErased); } + FastRandomContext rng; while (mapOrphanTransactions.size() > nMaxOrphans) { // Evict a random orphan: - uint256 randomhash = GetRandHash(); + uint256 randomhash = rng.rand256(); std::map::iterator it = mapOrphanTransactions.lower_bound(randomhash); if (it == mapOrphanTransactions.end()) it = mapOrphanTransactions.begin();