Merge pull request #3560 from patricklodder/compat/shuffle

random: use std::shuffle instead of std::random_shuffle
This commit is contained in:
chromatic 2024-06-22 00:13:50 -07:00 committed by GitHub
commit 2e37a3a1ba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View File

@ -1641,7 +1641,8 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
// Randomize entries before processing, to prevent an attacker to
// determine which entries will make it through the rate limit
random_shuffle(vAddr.begin(), vAddr.end(), GetRandInt);
FastRandomContext insecure_rand;
shuffle(vAddr.begin(), vAddr.end(), insecure_rand);
BOOST_FOREACH(CAddress& addr, vAddr)
{

View File

@ -2157,6 +2157,7 @@ bool CWallet::SelectCoinsMinConf(const CAmount& nTargetValue, const int nConfMin
{
setCoinsRet.clear();
nValueRet = 0;
FastRandomContext insecure_rand;
// List of values less than target
pair<CAmount, pair<const CWalletTx*,unsigned int> > coinLowestLarger;
@ -2165,7 +2166,7 @@ bool CWallet::SelectCoinsMinConf(const CAmount& nTargetValue, const int nConfMin
vector<pair<CAmount, pair<const CWalletTx*,unsigned int> > > vValue;
CAmount nTotalLower = 0;
random_shuffle(vCoins.begin(), vCoins.end(), GetRandInt);
shuffle(vCoins.begin(), vCoins.end(), insecure_rand);
BOOST_FOREACH(const COutput &output, vCoins)
{