diff options
author | Pieter Wuille <pieter@wuille.net> | 2023-09-08 11:48:09 -0400 |
---|---|---|
committer | Pieter Wuille <pieter@wuille.net> | 2023-09-10 16:11:52 -0400 |
commit | b6934fd03f080d437acb1fd2b665503c3d6de785 (patch) | |
tree | 908f31869071c72d6f2c2b7a0fc382c40706bd7b /src/test | |
parent | c5a63ea56f8347139bd84e1669b378ecfb234c3c (diff) |
net: merge V2Transport constructors, move key gen
This removes the ability for BIP324Cipher to generate its own key, moving that
responsibility to the caller (mostly, V2Transport). This allows us to write
the random-key V2Transport constructor by delegating to the explicit-key one.
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/net_tests.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/test/net_tests.cpp b/src/test/net_tests.cpp index 900e311d22..eac8e8146a 100644 --- a/src/test/net_tests.cpp +++ b/src/test/net_tests.cpp @@ -1008,6 +1008,14 @@ BOOST_AUTO_TEST_CASE(advertise_local_address) namespace { +CKey GenerateRandomTestKey() noexcept +{ + CKey key; + uint256 key_data = InsecureRand256(); + key.Set(key_data.begin(), key_data.end(), true); + return key; +} + /** A class for scenario-based tests of V2Transport * * Each V2TransportTester encapsulates a V2Transport (the one being tested), and can be told to @@ -1031,6 +1039,7 @@ public: /** Construct a tester object. test_initiator: whether the tested transport is initiator. */ V2TransportTester(bool test_initiator) : m_transport(0, test_initiator, SER_NETWORK, INIT_PROTO_VERSION), + m_cipher{GenerateRandomTestKey(), MakeByteSpan(InsecureRand256())}, m_test_initiator(test_initiator) {} /** Data type returned by Interact: |