mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-19 14:53:43 +01:00
random: replace construct/assign with explicit Reseed()
This commit is contained in:
@@ -704,6 +704,13 @@ void FastRandomContext::fillrand(Span<std::byte> output) noexcept
|
||||
|
||||
FastRandomContext::FastRandomContext(const uint256& seed) noexcept : requires_seed(false), rng(MakeByteSpan(seed)) {}
|
||||
|
||||
void FastRandomContext::Reseed(const uint256& seed) noexcept
|
||||
{
|
||||
FlushCache();
|
||||
requires_seed = false;
|
||||
rng = {MakeByteSpan(seed)};
|
||||
}
|
||||
|
||||
bool Random_SanityCheck()
|
||||
{
|
||||
uint64_t start = GetPerformanceCounter();
|
||||
@@ -759,15 +766,6 @@ FastRandomContext::FastRandomContext(bool fDeterministic) noexcept : requires_se
|
||||
// use.
|
||||
}
|
||||
|
||||
FastRandomContext& FastRandomContext::operator=(FastRandomContext&& from) noexcept
|
||||
{
|
||||
requires_seed = from.requires_seed;
|
||||
rng = from.rng;
|
||||
from.requires_seed = true;
|
||||
static_cast<RandomMixin<FastRandomContext>&>(*this) = std::move(from);
|
||||
return *this;
|
||||
}
|
||||
|
||||
void RandomInit()
|
||||
{
|
||||
// Invoke RNG code to trigger initialization (if not already performed)
|
||||
|
||||
Reference in New Issue
Block a user