diff options
Diffstat (limited to 'src/test/util/setup_common.h')
-rw-r--r-- | src/test/util/setup_common.h | 33 |
1 files changed, 1 insertions, 32 deletions
diff --git a/src/test/util/setup_common.h b/src/test/util/setup_common.h index b7429df02c..7cd4fdb417 100644 --- a/src/test/util/setup_common.h +++ b/src/test/util/setup_common.h @@ -11,7 +11,6 @@ #include <node/context.h> // IWYU pragma: export #include <primitives/transaction.h> #include <pubkey.h> -#include <random.h> #include <stdexcept> #include <util/chaintype.h> #include <util/check.h> @@ -25,6 +24,7 @@ class CFeeRate; class Chainstate; +class FastRandomContext; /** This is connected to the logger. Can be used to redirect logs to any other log */ extern const std::function<void(const std::string&)> G_TEST_LOG_FUN; @@ -41,37 +41,6 @@ std::ostream& operator<<(typename std::enable_if<std::is_enum<T>::value, std::os } } // namespace std -/** - * This global and the helpers that use it are not thread-safe. - * - * If thread-safety is needed, the global could be made thread_local (given - * that thread_local is supported on all architectures we support) or a - * per-thread instance could be used in the multi-threaded test. - */ -extern FastRandomContext g_insecure_rand_ctx; - -/** - * Flag to make GetRand in random.h return the same number - */ -extern bool g_mock_deterministic_tests; - -enum class SeedRand { - ZEROS, //!< Seed with a compile time constant of zeros - SEED, //!< Call the Seed() helper -}; - -/** Seed the given random ctx or use the seed passed in via an environment var */ -void Seed(FastRandomContext& ctx); - -static inline void SeedInsecureRand(SeedRand seed = SeedRand::SEED) -{ - if (seed == SeedRand::ZEROS) { - g_insecure_rand_ctx = FastRandomContext(/*fDeterministic=*/true); - } else { - Seed(g_insecure_rand_ctx); - } -} - static constexpr CAmount CENT{1000000}; /** Basic testing setup. |