mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-26 07:26:15 +01:00
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:
@@ -147,9 +147,9 @@ BOOST_AUTO_TEST_CASE(GetBlockProofEquivalentTime_test)
|
||||
}
|
||||
|
||||
for (int j = 0; j < 1000; j++) {
|
||||
CBlockIndex *p1 = &blocks[InsecureRandRange(10000)];
|
||||
CBlockIndex *p2 = &blocks[InsecureRandRange(10000)];
|
||||
CBlockIndex *p3 = &blocks[InsecureRandRange(10000)];
|
||||
CBlockIndex *p1 = &blocks[m_rng.randrange(10000)];
|
||||
CBlockIndex *p2 = &blocks[m_rng.randrange(10000)];
|
||||
CBlockIndex *p3 = &blocks[m_rng.randrange(10000)];
|
||||
|
||||
int64_t tdiff = GetBlockProofEquivalentTime(*p1, *p2, *p3, chainParams->GetConsensus());
|
||||
BOOST_CHECK_EQUAL(tdiff, p1->GetBlockTime() - p2->GetBlockTime());
|
||||
|
||||
Reference in New Issue
Block a user