mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-19 14:53:43 +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:
@@ -75,8 +75,8 @@ using node::VerifyLoadedChainstate;
|
||||
|
||||
const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr;
|
||||
|
||||
/** Random context to get unique temp data dirs. Separate from g_insecure_rand_ctx, which can be seeded from a const env var */
|
||||
static FastRandomContext g_insecure_rand_ctx_temp_path;
|
||||
/** Random context to get unique temp data dirs. Separate from m_rng, which can be seeded from a const env var */
|
||||
static FastRandomContext g_rng_temp_path;
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, const arith_uint256& num)
|
||||
{
|
||||
@@ -158,7 +158,7 @@ BasicTestingSetup::BasicTestingSetup(const ChainType chainType, TestOpts opts)
|
||||
|
||||
if (!m_node.args->IsArgSet("-testdatadir")) {
|
||||
// By default, the data directory has a random name
|
||||
const auto rand_str{g_insecure_rand_ctx_temp_path.rand256().ToString()};
|
||||
const auto rand_str{g_rng_temp_path.rand256().ToString()};
|
||||
m_path_root = fs::temp_directory_path() / "test_common_" PACKAGE_NAME / rand_str;
|
||||
TryCreateDirectories(m_path_root);
|
||||
} else {
|
||||
@@ -580,7 +580,7 @@ void TestChain100Setup::MockMempoolMinFee(const CFeeRate& target_feerate)
|
||||
// Manually create an invalid transaction. Manually set the fee in the CTxMemPoolEntry to
|
||||
// achieve the exact target feerate.
|
||||
CMutableTransaction mtx = CMutableTransaction();
|
||||
mtx.vin.emplace_back(COutPoint{Txid::FromUint256(g_insecure_rand_ctx.rand256()), 0});
|
||||
mtx.vin.emplace_back(COutPoint{Txid::FromUint256(m_rng.rand256()), 0});
|
||||
mtx.vout.emplace_back(1 * COIN, GetScriptForDestination(WitnessV0ScriptHash(CScript() << OP_TRUE)));
|
||||
const auto tx{MakeTransactionRef(mtx)};
|
||||
LockPoints lp;
|
||||
|
||||
Reference in New Issue
Block a user