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.
This commit is contained in:
Pieter Wuille
2023-09-08 11:48:09 -04:00
parent c5a63ea56f
commit b6934fd03f
4 changed files with 30 additions and 23 deletions

View File

@@ -41,8 +41,8 @@ private:
std::array<std::byte, GARBAGE_TERMINATOR_LEN> m_recv_garbage_terminator;
public:
/** Initialize a BIP324 cipher with securely generated random keys. */
BIP324Cipher() noexcept;
/** No default constructor; keys must be provided to create a BIP324Cipher. */
BIP324Cipher() = delete;
/** Initialize a BIP324 cipher with specified key and encoding entropy (testing only). */
BIP324Cipher(const CKey& key, Span<const std::byte> ent32) noexcept;