Inside Bitcoin
Opening the selected file…
Inside Bitcoin
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
251/*pszDest=*/fuzzed_data_provider.ConsumeBool() ? nullptr : random_string.c_str(),252/*conn_type=*/conn_type,253/*use_v2transport=*/fuzzed_data_provider.ConsumeBool(),254/*proxy_override=*/proxy_override);255},256[&] {257connman.SetNetworkActive(fuzzed_data_provider.ConsumeBool());258const auto peer = ConsumeAddress(fuzzed_data_provider);259connman.CreateNodeFromAcceptedSocketPublic(260/*sock=*/CreateSock(AF_INET, SOCK_STREAM, IPPROTO_TCP),261/*permissions=*/ConsumeWeakEnum(fuzzed_data_provider, ALL_NET_PERMISSION_FLAGS),262/*addr_bind=*/ConsumeAddress(fuzzed_data_provider),263/*addr_peer=*/peer);264},265[&] {266CConnman::Options options;268options.vBinds = ConsumeServiceVector(fuzzed_data_provider);270options.vWhiteBinds = std::vector<NetWhitebindPermissions>{271fuzzed_data_provider.ConsumeIntegralInRange<size_t>(0, 5)};272for (auto& wb : options.vWhiteBinds) {273wb.m_flags = ConsumeWeakEnum(fuzzed_data_provider, ALL_NET_PERMISSION_FLAGS);274wb.m_service = ConsumeService(fuzzed_data_provider);275}277options.onion_binds = ConsumeServiceVector(fuzzed_data_provider);279options.bind_on_any = options.vBinds.empty() && options.vWhiteBinds.empty() &&280options.onion_binds.empty();282connman.InitBindsPublic(options);283},284[&] {285connman.SocketHandlerPublic();286});287}288connman.ForEachNode([](CNode* pnode) {289(void)pnode->GetId();290(void)pnode->IsInboundConn();291(void)pnode->IsFullOutboundConn();292(void)pnode->ConnectionTypeAsString();293});294(void)connman.GetAddedNodeInfo(/*include_connected=*/false);295(void)connman.GetExtraFullOutboundCount();296assert(connman.GetLocalServices() == local_services);297assert(connman.GetMaxOutboundTarget() == max_outbound_limit);298const auto time_left_in_cycle{connman.GetMaxOutboundTimeLeftInCycle()};299std::vector<CNodeStats> stats;300connman.GetNodeStats(stats);301const auto bytes_left{connman.GetOutboundTargetBytesLeft()};302assert(bytes_left <= max_outbound_limit);303if (max_outbound_limit == 0) {304assert(bytes_left == 0);305assert(time_left_in_cycle == std::chrono::seconds{0});306assert(!connman.OutboundTargetReached(/*historicalBlockServingLimit=*/false));307assert(!connman.OutboundTargetReached(/*historicalBlockServingLimit=*/true));308}309assert(connman.GetTotalBytesRecv() >= total_bytes_recv_initial);310assert(connman.GetTotalBytesSent() >= total_bytes_sent_initial);311(void)connman.GetTryNewOutboundPeer();312assert(connman.GetUseAddrmanOutgoing() == use_addrman_outgoing);313(void)connman.ASMapHealthCheck();315connman.ClearTestNodes();316g_dns_lookup = g_dns_lookup_orig;317CreateSock = CreateSockOrig;318}
Independent explanations by MyBitcoinExplorer. Not affiliated with or endorsed by Bitcoin Core. Guides are educational and do not replace the source or its tests.
Bitcoin Core source © its contributors, distributed under the MIT license. Original notices and bundled third-party licenses are retained in the source tree.