mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 06:28:31 +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:
@@ -50,8 +50,7 @@ BOOST_AUTO_TEST_CASE(GetSigOpCount)
|
||||
std::vector<CPubKey> keys;
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
CKey k;
|
||||
k.MakeNewKey(true);
|
||||
CKey k = GenerateRandomKey();
|
||||
keys.push_back(k.GetPubKey());
|
||||
}
|
||||
CScript s2 = GetScriptForMultisig(1, keys);
|
||||
@@ -120,8 +119,7 @@ BOOST_AUTO_TEST_CASE(GetTxSigOpCost)
|
||||
CCoinsView coinsDummy;
|
||||
CCoinsViewCache coins(&coinsDummy);
|
||||
// Create key
|
||||
CKey key;
|
||||
key.MakeNewKey(true);
|
||||
CKey key = GenerateRandomKey();
|
||||
CPubKey pubkey = key.GetPubKey();
|
||||
// Default flags
|
||||
const uint32_t flags{SCRIPT_VERIFY_WITNESS | SCRIPT_VERIFY_P2SH};
|
||||
|
||||
Reference in New Issue
Block a user