Bugfix: randbytes should seed when needed (non reachable issue)

This commit is contained in:
Pieter Wuille
2018-10-31 14:25:11 -07:00
parent 273d02580a
commit 8d98d42611
2 changed files with 13 additions and 5 deletions

View File

@@ -398,6 +398,7 @@ uint256 FastRandomContext::rand256()
std::vector<unsigned char> FastRandomContext::randbytes(size_t len)
{
if (requires_seed) RandomSeed();
std::vector<unsigned char> ret(len);
if (len > 0) {
rng.Output(&ret[0], len);