diff options
| author | Pieter Wuille <[email protected]> | 2017-05-23 15:09:30 -0700 |
|---|---|---|
| committer | Pieter Wuille <[email protected]> | 2017-06-05 12:44:44 -0700 |
| commit | 124d13a58cdcd9f66eeffc7e6281e3eb129e3398 (patch) | |
| tree | 27b689722c38170f22543453fbf06b41fb336846 /src/test/test_bitcoin.h | |
| parent | scripted-diff: Rename cuckoo tests' local rand context (diff) | |
| download | discoin-124d13a58cdcd9f66eeffc7e6281e3eb129e3398.tar.xz discoin-124d13a58cdcd9f66eeffc7e6281e3eb129e3398.zip | |
Merge test_random.h into test_bitcoin.h
Diffstat (limited to 'src/test/test_bitcoin.h')
| -rw-r--r-- | src/test/test_bitcoin.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/test/test_bitcoin.h b/src/test/test_bitcoin.h index 60a86d8c4..80d46e04a 100644 --- a/src/test/test_bitcoin.h +++ b/src/test/test_bitcoin.h @@ -9,11 +9,30 @@ #include "fs.h" #include "key.h" #include "pubkey.h" +#include "random.h" #include "txdb.h" #include "txmempool.h" #include <boost/thread.hpp> +extern uint256 insecure_rand_seed; +extern FastRandomContext insecure_rand_ctx; + +static inline void seed_insecure_rand(bool fDeterministic = false) +{ + if (fDeterministic) { + insecure_rand_seed = uint256(); + } else { + insecure_rand_seed = GetRandHash(); + } + insecure_rand_ctx = FastRandomContext(insecure_rand_seed); +} + +static inline uint32_t insecure_rand(void) +{ + return insecure_rand_ctx.rand32(); +} + /** Basic testing setup. * This just configures logging and chain parameters. */ |