Skip to content

Commit

Permalink
Simplify testing RNG code
Browse files Browse the repository at this point in the history
  • Loading branch information
Fuzzbawls committed Apr 14, 2021
1 parent 972effa commit 32e6c42
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
3 changes: 1 addition & 2 deletions src/test/test_pivx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ std::unique_ptr<CConnman> g_connman;

CClientUIInterface uiInterface; // Declared but not defined in guiinterface.h

uint256 insecure_rand_seed = GetRandHash();
FastRandomContext insecure_rand_ctx(insecure_rand_seed);
FastRandomContext insecure_rand_ctx;

extern bool fPrintToConsole;
extern void noui_connect();
Expand Down
10 changes: 2 additions & 8 deletions src/test/test_pivx.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,11 @@

#include <boost/thread.hpp>

extern uint256 insecure_rand_seed;
extern FastRandomContext insecure_rand_ctx;

static inline void SeedInsecureRand(bool fDeterministic = false)
static inline void SeedInsecureRand(bool deterministic = false)
{
if (fDeterministic) {
insecure_rand_seed = uint256();
} else {
insecure_rand_seed = GetRandHash();
}
insecure_rand_ctx = FastRandomContext(insecure_rand_seed);
insecure_rand_ctx = FastRandomContext(deterministic);
}

static inline uint32_t InsecureRand32() { return insecure_rand_ctx.rand32(); }
Expand Down

0 comments on commit 32e6c42

Please sign in to comment.