aboutsummaryrefslogtreecommitdiff
path: root/src/test/util/net.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/util/net.cpp')
-rw-r--r--src/test/util/net.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/test/util/net.cpp b/src/test/util/net.cpp
index bf5a653090..e0404e33ed 100644
--- a/src/test/util/net.cpp
+++ b/src/test/util/net.cpp
@@ -4,11 +4,15 @@
#include <test/util/net.h>
-#include <chainparams.h>
-#include <node/eviction.h>
#include <net.h>
#include <net_processing.h>
+#include <netaddress.h>
#include <netmessagemaker.h>
+#include <node/connection_types.h>
+#include <node/eviction.h>
+#include <protocol.h>
+#include <random.h>
+#include <serialize.h>
#include <span.h>
#include <vector>
@@ -98,6 +102,17 @@ bool ConnmanTestMsg::ReceiveMsgFrom(CNode& node, CSerializedNetMsg&& ser_msg) co
return complete;
}
+CNode* ConnmanTestMsg::ConnectNodePublic(PeerManager& peerman, const char* pszDest, ConnectionType conn_type)
+{
+ CNode* node = ConnectNode(CAddress{}, pszDest, /*fCountFailure=*/false, conn_type, /*use_v2transport=*/true);
+ if (!node) return nullptr;
+ node->SetCommonVersion(PROTOCOL_VERSION);
+ peerman.InitializeNode(*node, ServiceFlags(NODE_NETWORK | NODE_WITNESS));
+ node->fSuccessfullyConnected = true;
+ AddTestNode(*node);
+ return node;
+}
+
std::vector<NodeEvictionCandidate> GetRandomNodeEvictionCandidates(int n_candidates, FastRandomContext& random_context)
{
std::vector<NodeEvictionCandidate> candidates;