mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-27 07:18:33 +02:00
scripted-diff: Use new naming style for insecure_rand* functions
-BEGIN VERIFY SCRIPT- sed -i 's/\<insecure_randbits(/InsecureRandBits(/g' src/test/*.cpp src/test/*.h src/wallet/test/*.cpp sed -i 's/\<insecure_randbool(/InsecureRandBool(/g' src/test/*.cpp src/test/*.h src/wallet/test/*.cpp sed -i 's/\<insecure_randrange(/InsecureRandRange(/g' src/test/*.cpp src/test/*.h src/wallet/test/*.cpp sed -i 's/\<insecure_randbytes(/InsecureRandBytes(/g' src/test/*.cpp src/test/*.h src/wallet/test/*.cpp sed -i 's/\<insecure_rand256(/InsecureRand256(/g' src/test/*.cpp src/test/*.h src/wallet/test/*.cpp sed -i 's/\<insecure_rand(/InsecureRand32(/g' src/test/*.cpp src/test/*.h src/wallet/test/*.cpp sed -i 's/\<seed_insecure_rand(/SeedInsecureRand(/g' src/test/*.cpp src/test/*.h src/wallet/test/*.cpp -END VERIFY SCRIPT-
This commit is contained in:
@@ -34,8 +34,8 @@ BOOST_AUTO_TEST_CASE(skiplist_test)
|
||||
}
|
||||
|
||||
for (int i=0; i < 1000; i++) {
|
||||
int from = insecure_randrange(SKIPLIST_LENGTH - 1);
|
||||
int to = insecure_randrange(from + 1);
|
||||
int from = InsecureRandRange(SKIPLIST_LENGTH - 1);
|
||||
int to = InsecureRandRange(from + 1);
|
||||
|
||||
BOOST_CHECK(vIndex[SKIPLIST_LENGTH - 1].GetAncestor(from) == &vIndex[from]);
|
||||
BOOST_CHECK(vIndex[from].GetAncestor(to) == &vIndex[to]);
|
||||
@@ -77,7 +77,7 @@ BOOST_AUTO_TEST_CASE(getlocator_test)
|
||||
|
||||
// Test 100 random starting points for locators.
|
||||
for (int n=0; n<100; n++) {
|
||||
int r = insecure_randrange(150000);
|
||||
int r = InsecureRandRange(150000);
|
||||
CBlockIndex* tip = (r < 100000) ? &vBlocksMain[r] : &vBlocksSide[r - 100000];
|
||||
CBlockLocator locator = chain.GetLocator(tip);
|
||||
|
||||
@@ -115,7 +115,7 @@ BOOST_AUTO_TEST_CASE(findearliestatleast_test)
|
||||
} else {
|
||||
// randomly choose something in the range [MTP, MTP*2]
|
||||
int64_t medianTimePast = vBlocksMain[i].GetMedianTimePast();
|
||||
int r = insecure_randrange(medianTimePast);
|
||||
int r = InsecureRandRange(medianTimePast);
|
||||
vBlocksMain[i].nTime = r + medianTimePast;
|
||||
vBlocksMain[i].nTimeMax = std::max(vBlocksMain[i].nTime, vBlocksMain[i-1].nTimeMax);
|
||||
}
|
||||
@@ -134,7 +134,7 @@ BOOST_AUTO_TEST_CASE(findearliestatleast_test)
|
||||
// Verify that FindEarliestAtLeast is correct.
|
||||
for (unsigned int i=0; i<10000; ++i) {
|
||||
// Pick a random element in vBlocksMain.
|
||||
int r = insecure_randrange(vBlocksMain.size());
|
||||
int r = InsecureRandRange(vBlocksMain.size());
|
||||
int64_t test_time = vBlocksMain[r].nTime;
|
||||
CBlockIndex *ret = chain.FindEarliestAtLeast(test_time);
|
||||
BOOST_CHECK(ret->nTimeMax >= test_time);
|
||||
|
||||
Reference in New Issue
Block a user