diff --git a/libdevcrypto/Common.cpp b/libdevcrypto/Common.cpp index a2907d2ed..e1ea2d6ec 100644 --- a/libdevcrypto/Common.cpp +++ b/libdevcrypto/Common.cpp @@ -308,33 +308,14 @@ h256 crypto::kdf(Secret const& _priv, h256 const& _hash) return s; } -string const& Nonce::seedFilePath(string const& _filePath) -{ - static mutex x_seedFile; - static string s_seedFile; - - Guard l(x_seedFile); - if (s_seedFile.empty()) - s_seedFile = _filePath.empty() ? getDataDir() + "/seed" : _filePath; - return s_seedFile; -} - Secret Nonce::next() { Guard l(x_value); if (!m_value) { - bytesSec b = contentsSec(seedFilePath()); - if (b.size() == 32) - b.ref().populate(m_value.writable().ref()); - else - m_value = Secret::random(); + m_value = Secret::random(); if (!m_value) BOOST_THROW_EXCEPTION(InvalidState()); - - // prevent seed reuse if process terminates abnormally - // this might throw - writeFile(seedFilePath(), bytes()); } m_value = sha3Secure(m_value.ref()); return sha3(~m_value); diff --git a/libdevcrypto/Common.h b/libdevcrypto/Common.h index debeee8d6..22460e940 100644 --- a/libdevcrypto/Common.h +++ b/libdevcrypto/Common.h @@ -203,14 +203,8 @@ public: /// Returns the next nonce (might be read from a file). static Secret get() { static Nonce s; return s.next(); } - /// @returns path of the seed file. FOR TESTS ONLY: optionally set path to @_filePath. - static std::string const& seedFilePath(std::string const& _filePath = std::string()); - private: Nonce() = default; - - /// Destructor. IO operation may throw. - ~Nonce() { if (m_value && next()) dev::writeFile(seedFilePath(), m_value.ref()); } /// @returns the next nonce. Secret next(); diff --git a/test/TestUtils.cpp b/test/TestUtils.cpp index 0ec76386b..5e0619c0e 100644 --- a/test/TestUtils.cpp +++ b/test/TestUtils.cpp @@ -120,8 +120,3 @@ void ParallelClientBaseFixture::enumerateClients(std::function