| 110 | |
| 111 | struct OutboundTest : TestingSetup { |
| 112 | void AddRandomOutboundPeer(NodeId& id, std::vector<CNode*>& vNodes, PeerManager& peerLogic, ConnmanTestMsg& connman, ConnectionType connType, bool onion_peer = false) |
| 113 | { |
| 114 | CAddress addr; |
| 115 | |
| 116 | if (onion_peer) { |
| 117 | auto tor_addr{m_rng.randbytes(ADDR_TORV3_SIZE)}; |
| 118 | BOOST_REQUIRE(addr.SetSpecial(OnionToString(tor_addr))); |
| 119 | } |
| 120 | |
| 121 | while (!addr.IsRoutable()) { |
| 122 | addr = CAddress(ip(m_rng.randbits(32)), NODE_NONE); |
| 123 | } |
| 124 | |
| 125 | vNodes.emplace_back(new CNode{id++, |
| 126 | /*sock=*/nullptr, |
| 127 | addr, |
| 128 | /*nKeyedNetGroupIn=*/0, |
| 129 | /*nLocalHostNonceIn=*/0, |
| 130 | CAddress(), |
| 131 | /*addrNameIn=*/"", |
| 132 | connType, |
| 133 | /*inbound_onion=*/false, |
| 134 | /*network_key=*/0}); |
| 135 | CNode &node = *vNodes.back(); |
| 136 | node.SetCommonVersion(PROTOCOL_VERSION); |
| 137 | |
| 138 | peerLogic.InitializeNode(node, ServiceFlags(NODE_NETWORK | NODE_WITNESS)); |
| 139 | node.fSuccessfullyConnected = true; |
| 140 | |
| 141 | connman.AddTestNode(node); |
| 142 | } |
| 143 | }; // struct OutboundTest |
| 144 | |
| 145 | BOOST_FIXTURE_TEST_CASE(stale_tip_peer_management, OutboundTest) |
nothing calls this directly
no test coverage detected