aboutsummaryrefslogtreecommitdiff
path: root/src/test/util/setup_common.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/util/setup_common.cpp')
-rw-r--r--src/test/util/setup_common.cpp22
1 files changed, 2 insertions, 20 deletions
diff --git a/src/test/util/setup_common.cpp b/src/test/util/setup_common.cpp
index d8f30bdc6e..6ae2187974 100644
--- a/src/test/util/setup_common.cpp
+++ b/src/test/util/setup_common.cpp
@@ -32,6 +32,7 @@
#include <policy/fees.h>
#include <policy/fees_args.h>
#include <pow.h>
+#include <random.h>
#include <rpc/blockchain.h>
#include <rpc/register.h>
#include <rpc/server.h>
@@ -40,6 +41,7 @@
#include <shutdown.h>
#include <streams.h>
#include <test/util/net.h>
+#include <test/util/random.h>
#include <test/util/txmempool.h>
#include <timedata.h>
#include <txdb.h>
@@ -73,29 +75,9 @@ using node::VerifyLoadedChainstate;
const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr;
UrlDecodeFn* const URL_DECODE = nullptr;
-FastRandomContext g_insecure_rand_ctx;
/** 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;
-/** Return the unsigned from the environment var if available, otherwise 0 */
-static uint256 GetUintFromEnv(const std::string& env_name)
-{
- const char* num = std::getenv(env_name.c_str());
- if (!num) return {};
- return uint256S(num);
-}
-
-void Seed(FastRandomContext& ctx)
-{
- // Should be enough to get the seed once for the process
- static uint256 seed{};
- static const std::string RANDOM_CTX_SEED{"RANDOM_CTX_SEED"};
- if (seed.IsNull()) seed = GetUintFromEnv(RANDOM_CTX_SEED);
- if (seed.IsNull()) seed = GetRandHash();
- LogPrintf("%s: Setting random seed for current tests to %s=%s\n", __func__, RANDOM_CTX_SEED, seed.GetHex());
- ctx = FastRandomContext(seed);
-}
-
std::ostream& operator<<(std::ostream& os, const uint256& num)
{
os << num.ToString();