Skip to content

Commit 6be319b

Browse files
author
MarcoFalke
committed
Merge bitcoin/bitcoin#24841: test: fix connman UB by calling derived constructor
c848a45 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
2 parents f3e0ace + c848a45 commit 6be319b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/test/util/setup_common.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
#include <interfaces/chain.h>
1616
#include <net.h>
1717
#include <net_processing.h>
18-
#include <node/miner.h>
19-
#include <noui.h>
2018
#include <node/blockstorage.h>
2119
#include <node/chainstate.h>
20+
#include <node/miner.h>
21+
#include <noui.h>
2222
#include <policy/fees.h>
2323
#include <pow.h>
2424
#include <rpc/blockchain.h>
@@ -28,6 +28,7 @@
2828
#include <script/sigcache.h>
2929
#include <shutdown.h>
3030
#include <streams.h>
31+
#include <test/util/net.h>
3132
#include <txdb.h>
3233
#include <util/strencodings.h>
3334
#include <util/string.h>
@@ -226,7 +227,7 @@ TestingSetup::TestingSetup(const std::string& chainName, const std::vector<const
226227
/*deterministic=*/false,
227228
m_node.args->GetIntArg("-checkaddrman", 0));
228229
m_node.banman = std::make_unique<BanMan>(m_args.GetDataDirBase() / "banlist", nullptr, DEFAULT_MISBEHAVING_BANTIME);
229-
m_node.connman = std::make_unique<CConnman>(0x1337, 0x1337, *m_node.addrman); // Deterministic randomness for tests.
230+
m_node.connman = std::make_unique<ConnmanTestMsg>(0x1337, 0x1337, *m_node.addrman); // Deterministic randomness for tests.
230231
m_node.peerman = PeerManager::make(chainparams, *m_node.connman, *m_node.addrman,
231232
m_node.banman.get(), *m_node.chainman,
232233
*m_node.mempool, false);

0 commit comments

Comments
 (0)