|
32 | 32 | #include <policy/fees.h>
|
33 | 33 | #include <policy/fees_args.h>
|
34 | 34 | #include <pow.h>
|
| 35 | +#include <random.h> |
35 | 36 | #include <rpc/blockchain.h>
|
36 | 37 | #include <rpc/register.h>
|
37 | 38 | #include <rpc/server.h>
|
|
40 | 41 | #include <shutdown.h>
|
41 | 42 | #include <streams.h>
|
42 | 43 | #include <test/util/net.h>
|
| 44 | +#include <test/util/random.h> |
43 | 45 | #include <test/util/txmempool.h>
|
44 | 46 | #include <timedata.h>
|
45 | 47 | #include <txdb.h>
|
@@ -73,29 +75,9 @@ using node::VerifyLoadedChainstate;
|
73 | 75 | const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr;
|
74 | 76 | UrlDecodeFn* const URL_DECODE = nullptr;
|
75 | 77 |
|
76 |
| -FastRandomContext g_insecure_rand_ctx; |
77 | 78 | /** Random context to get unique temp data dirs. Separate from g_insecure_rand_ctx, which can be seeded from a const env var */
|
78 | 79 | static FastRandomContext g_insecure_rand_ctx_temp_path;
|
79 | 80 |
|
80 |
| -/** Return the unsigned from the environment var if available, otherwise 0 */ |
81 |
| -static uint256 GetUintFromEnv(const std::string& env_name) |
82 |
| -{ |
83 |
| - const char* num = std::getenv(env_name.c_str()); |
84 |
| - if (!num) return {}; |
85 |
| - return uint256S(num); |
86 |
| -} |
87 |
| - |
88 |
| -void Seed(FastRandomContext& ctx) |
89 |
| -{ |
90 |
| - // Should be enough to get the seed once for the process |
91 |
| - static uint256 seed{}; |
92 |
| - static const std::string RANDOM_CTX_SEED{"RANDOM_CTX_SEED"}; |
93 |
| - if (seed.IsNull()) seed = GetUintFromEnv(RANDOM_CTX_SEED); |
94 |
| - if (seed.IsNull()) seed = GetRandHash(); |
95 |
| - LogPrintf("%s: Setting random seed for current tests to %s=%s\n", __func__, RANDOM_CTX_SEED, seed.GetHex()); |
96 |
| - ctx = FastRandomContext(seed); |
97 |
| -} |
98 |
| - |
99 | 81 | std::ostream& operator<<(std::ostream& os, const uint256& num)
|
100 | 82 | {
|
101 | 83 | os << num.ToString();
|
|
0 commit comments