mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 14:38:29 +01:00
refactor: share and use GenerateRandomKey helper
Making the `GenerateRandomKey` helper available to other modules via
key.{h.cpp} allows us to create random private keys directly at
instantiation of CKey, in contrast to the two-step process of creating
the instance and then having to call `MakeNewKey(...)`.
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
#include <consensus/consensus.h>
|
||||
#include <crypto/sha256.h>
|
||||
#include <i2p.h>
|
||||
#include <key.h>
|
||||
#include <logging.h>
|
||||
#include <memusage.h>
|
||||
#include <net_permissions.h>
|
||||
@@ -938,13 +939,6 @@ public:
|
||||
|
||||
const V2MessageMap V2_MESSAGE_MAP;
|
||||
|
||||
CKey GenerateRandomKey() noexcept
|
||||
{
|
||||
CKey key;
|
||||
key.MakeNewKey(/*fCompressed=*/true);
|
||||
return key;
|
||||
}
|
||||
|
||||
std::vector<uint8_t> GenerateRandomGarbage() noexcept
|
||||
{
|
||||
std::vector<uint8_t> ret;
|
||||
|
||||
Reference in New Issue
Block a user