scripted-diff: [test] Use g_rng/m_rng directly

-BEGIN VERIFY SCRIPT-

 # Use m_rng in unit test files
 ren() { sed -i "s:\<$1\>:$2:g" $( git grep -l "$1" src/test/*.cpp src/wallet/test/*.cpp src/test/util/setup_common.cpp ) ; }
 ren InsecureRand32                m_rng.rand32
 ren InsecureRand256               m_rng.rand256
 ren InsecureRandBits              m_rng.randbits
 ren InsecureRandRange             m_rng.randrange
 ren InsecureRandBool              m_rng.randbool
 ren g_insecure_rand_ctx           m_rng
 ren g_insecure_rand_ctx_temp_path g_rng_temp_path

-END VERIFY SCRIPT-
This commit is contained in:
MarcoFalke
2024-08-02 11:35:15 +02:00
parent fa54cab473
commit fa0fe08eca
40 changed files with 286 additions and 286 deletions

View File

@@ -31,7 +31,7 @@ public:
CTransactionRef RandomOrphan()
{
std::map<Wtxid, OrphanTx>::iterator it;
it = m_orphans.lower_bound(Wtxid::FromUint256(InsecureRand256()));
it = m_orphans.lower_bound(Wtxid::FromUint256(m_rng.rand256()));
if (it == m_orphans.end())
it = m_orphans.begin();
return it->second.tx;
@@ -108,7 +108,7 @@ BOOST_AUTO_TEST_CASE(DoS_mapOrphans)
// ecdsa_signature_parse_der_lax are executed during this test.
// Specifically branches that run only when an ECDSA
// signature's R and S values have leading zeros.
g_insecure_rand_ctx.Reseed(uint256{33});
m_rng.Reseed(uint256{33});
TxOrphanageTest orphanage{m_rng};
CKey key;
@@ -126,7 +126,7 @@ BOOST_AUTO_TEST_CASE(DoS_mapOrphans)
CMutableTransaction tx;
tx.vin.resize(1);
tx.vin[0].prevout.n = 0;
tx.vin[0].prevout.hash = Txid::FromUint256(InsecureRand256());
tx.vin[0].prevout.hash = Txid::FromUint256(m_rng.rand256());
tx.vin[0].scriptSig << OP_1;
tx.vout.resize(1);
tx.vout[0].nValue = 1*CENT;