diff options
author | MarcoFalke <falke.marco@gmail.com> | 2022-04-16 09:10:26 +0200 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2022-04-16 09:10:29 +0200 |
commit | 6be319beb8d6281cd82be8132dc4b765978122ba (patch) | |
tree | 722990918abc56648ba7fcb05ed7740f2cadedfb /src | |
parent | f3e0ace8ecd84009a23da6b0de47f01d79c45772 (diff) | |
parent | c848a45101b4dbd750739e7a6e5bdeec79920273 (diff) | |
download | bitcoin-6be319beb8d6281cd82be8132dc4b765978122ba.tar.xz |
Merge bitcoin/bitcoin#24841: test: fix connman UB by calling derived constructor
c848a45101b4dbd750739e7a6e5bdeec79920273 test: fix connman UB by calling derived constructor (chinggg)
Pull request description:
Hopefully closes #24373 by calling `ConnmanTestMsg` test-constructor to avoid undefined behavior in process_message.cpp after casting `g_setup->m_node.connman`.
Top commit has no ACKs.
Tree-SHA512: c3dce9dcce33614c7b739edf28e416b600ab3d38d16cdb0430490e8ffc9b64aff9292006ae6fe7c636ab0627893bb21f69435893bdfb129a9a865be92baa6f17
Diffstat (limited to 'src')
-rw-r--r-- | src/test/util/setup_common.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/test/util/setup_common.cpp b/src/test/util/setup_common.cpp index 211153f06c..13f17ca277 100644 --- a/src/test/util/setup_common.cpp +++ b/src/test/util/setup_common.cpp @@ -15,10 +15,10 @@ #include <interfaces/chain.h> #include <net.h> #include <net_processing.h> -#include <node/miner.h> -#include <noui.h> #include <node/blockstorage.h> #include <node/chainstate.h> +#include <node/miner.h> +#include <noui.h> #include <policy/fees.h> #include <pow.h> #include <rpc/blockchain.h> @@ -28,6 +28,7 @@ #include <script/sigcache.h> #include <shutdown.h> #include <streams.h> +#include <test/util/net.h> #include <txdb.h> #include <util/strencodings.h> #include <util/string.h> @@ -226,7 +227,7 @@ TestingSetup::TestingSetup(const std::string& chainName, const std::vector<const /*deterministic=*/false, m_node.args->GetIntArg("-checkaddrman", 0)); m_node.banman = std::make_unique<BanMan>(m_args.GetDataDirBase() / "banlist", nullptr, DEFAULT_MISBEHAVING_BANTIME); - m_node.connman = std::make_unique<CConnman>(0x1337, 0x1337, *m_node.addrman); // Deterministic randomness for tests. + m_node.connman = std::make_unique<ConnmanTestMsg>(0x1337, 0x1337, *m_node.addrman); // Deterministic randomness for tests. m_node.peerman = PeerManager::make(chainparams, *m_node.connman, *m_node.addrman, m_node.banman.get(), *m_node.chainman, *m_node.mempool, false); |