diff options
author | Sebastian Falbesoner <sebastian.falbesoner@gmail.com> | 2023-09-12 03:35:40 +0200 |
---|---|---|
committer | Sebastian Falbesoner <sebastian.falbesoner@gmail.com> | 2023-12-23 13:26:00 +0100 |
commit | fa1d49542e4b69a5d8b1177ffe4207f051a468bb (patch) | |
tree | 9c2cf8f46ea9d058c7c1c38d7244eb8eefc3b6fd /src/test/sigopcount_tests.cpp | |
parent | 4b1196a9855dcd188a24f393aa2fa21e2d61f061 (diff) |
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(...)`.
Diffstat (limited to 'src/test/sigopcount_tests.cpp')
-rw-r--r-- | src/test/sigopcount_tests.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/test/sigopcount_tests.cpp b/src/test/sigopcount_tests.cpp index c0bed50e1d..2081acdf4d 100644 --- a/src/test/sigopcount_tests.cpp +++ b/src/test/sigopcount_tests.cpp @@ -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}; |