mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-10 22:18:54 +01:00
scripted-diff: use insecure_rand256/randrange more
-BEGIN VERIFY SCRIPT- sed -i "s/\<GetRandHash(/insecure_rand256(/" src/test/*_tests.cpp sed -i "s/\<GetRand(/insecure_randrange(/" src/test/*_tests.cpp src/test/test_bitcoin.cpp sed -i 's/\<insecure_rand() % \([0-9]\+\)/insecure_randrange(\1)/g' src/test/*_tests.cpp -END VERIFY SCRIPT-
This commit is contained in:
@@ -31,7 +31,7 @@ BOOST_AUTO_TEST_CASE(dbwrapper)
|
||||
fs::path ph = fs::temp_directory_path() / fs::unique_path();
|
||||
CDBWrapper dbw(ph, (1 << 20), true, false, obfuscate);
|
||||
char key = 'k';
|
||||
uint256 in = GetRandHash();
|
||||
uint256 in = insecure_rand256();
|
||||
uint256 res;
|
||||
|
||||
// Ensure that we're doing real obfuscation when obfuscate=true
|
||||
@@ -53,11 +53,11 @@ BOOST_AUTO_TEST_CASE(dbwrapper_batch)
|
||||
CDBWrapper dbw(ph, (1 << 20), true, false, obfuscate);
|
||||
|
||||
char key = 'i';
|
||||
uint256 in = GetRandHash();
|
||||
uint256 in = insecure_rand256();
|
||||
char key2 = 'j';
|
||||
uint256 in2 = GetRandHash();
|
||||
uint256 in2 = insecure_rand256();
|
||||
char key3 = 'k';
|
||||
uint256 in3 = GetRandHash();
|
||||
uint256 in3 = insecure_rand256();
|
||||
|
||||
uint256 res;
|
||||
CDBBatch batch(dbw);
|
||||
@@ -91,10 +91,10 @@ BOOST_AUTO_TEST_CASE(dbwrapper_iterator)
|
||||
|
||||
// The two keys are intentionally chosen for ordering
|
||||
char key = 'j';
|
||||
uint256 in = GetRandHash();
|
||||
uint256 in = insecure_rand256();
|
||||
BOOST_CHECK(dbw.Write(key, in));
|
||||
char key2 = 'k';
|
||||
uint256 in2 = GetRandHash();
|
||||
uint256 in2 = insecure_rand256();
|
||||
BOOST_CHECK(dbw.Write(key2, in2));
|
||||
|
||||
std::unique_ptr<CDBIterator> it(const_cast<CDBWrapper*>(&dbw)->NewIterator());
|
||||
@@ -132,7 +132,7 @@ BOOST_AUTO_TEST_CASE(existing_data_no_obfuscate)
|
||||
// Set up a non-obfuscated wrapper to write some initial data.
|
||||
CDBWrapper* dbw = new CDBWrapper(ph, (1 << 10), false, false, false);
|
||||
char key = 'k';
|
||||
uint256 in = GetRandHash();
|
||||
uint256 in = insecure_rand256();
|
||||
uint256 res;
|
||||
|
||||
BOOST_CHECK(dbw->Write(key, in));
|
||||
@@ -155,7 +155,7 @@ BOOST_AUTO_TEST_CASE(existing_data_no_obfuscate)
|
||||
BOOST_CHECK(!odbw.IsEmpty()); // There should be existing data
|
||||
BOOST_CHECK(is_null_key(dbwrapper_private::GetObfuscateKey(odbw))); // The key should be an empty string
|
||||
|
||||
uint256 in2 = GetRandHash();
|
||||
uint256 in2 = insecure_rand256();
|
||||
uint256 res3;
|
||||
|
||||
// Check that we can write successfully
|
||||
@@ -174,7 +174,7 @@ BOOST_AUTO_TEST_CASE(existing_data_reindex)
|
||||
// Set up a non-obfuscated wrapper to write some initial data.
|
||||
CDBWrapper* dbw = new CDBWrapper(ph, (1 << 10), false, false, false);
|
||||
char key = 'k';
|
||||
uint256 in = GetRandHash();
|
||||
uint256 in = insecure_rand256();
|
||||
uint256 res;
|
||||
|
||||
BOOST_CHECK(dbw->Write(key, in));
|
||||
@@ -193,7 +193,7 @@ BOOST_AUTO_TEST_CASE(existing_data_reindex)
|
||||
BOOST_CHECK(!odbw.Read(key, res2));
|
||||
BOOST_CHECK(!is_null_key(dbwrapper_private::GetObfuscateKey(odbw)));
|
||||
|
||||
uint256 in2 = GetRandHash();
|
||||
uint256 in2 = insecure_rand256();
|
||||
uint256 res3;
|
||||
|
||||
// Check that we can write successfully
|
||||
|
||||
Reference in New Issue
Block a user