Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

p2p: standardize outbound full/block relay connection type naming #20729

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/files.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Subdirectory | File(s) | Description
`indexes/blockfilter/basic/db/` | LevelDB database | Blockfilter index LevelDB database for the basic filtertype; *optional*, used if `-blockfilterindex=basic`
`indexes/blockfilter/basic/` | `fltrNNNNN.dat`<sup>[\[2\]](#note2)</sup> | Blockfilter index filters for the basic filtertype; *optional*, used if `-blockfilterindex=basic`
`wallets/` | | [Contains wallets](#multi-wallet-environment); can be specified by `-walletdir` option; if `wallets/` subdirectory does not exist, wallets reside in the [data directory](#data-directory-location)
`./` | `anchors.dat` | Anchor IP address database, created on shutdown and deleted at startup. Anchors are last known outgoing block-relay-only peers that are tried to re-connect to on startup
`./` | `anchors.dat` | Anchor IP address database, created on shutdown and deleted at startup. Anchors are last known outbound-block-relay peers that are tried to re-connect to on startup
`./` | `banlist.dat` | Stores the IPs/subnets of banned nodes
`./` | `bitcoin.conf` | User-defined [configuration settings](bitcoin-conf.md) for `bitcoind` or `bitcoin-qt`. File is not written to by the software and must be created manually. Path can be specified by `-conf` option
`./` | `bitcoind.pid` | Stores the process ID (PID) of `bitcoind` or `bitcoin-qt` while running; created at start and deleted on shutdown; can be specified by `-pid` option
Expand Down
2 changes: 1 addition & 1 deletion doc/reduce-memory.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ The size of some in-memory caches can be reduced. As caches trade off memory usa

- `-maxconnections=<n>` - the maximum number of connections, this defaults to 125. Each active connection takes up some
memory. This option applies only if incoming connections are enabled, otherwise the number of connections will never
be more than 10. Of the 10 outbound peers, there can be 8 full-relay connections and 2 block-relay-only ones.
be more than 10. Of the 10 outbound peers, there can be 8 outbound-full-relay connections and 2 outbound-block-relay ones.

## Thread configuration

Expand Down
4 changes: 2 additions & 2 deletions doc/reduce-traffic.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ Some node operators need to deal with bandwidth caps imposed by their ISPs.

By default, Bitcoin Core allows up to 125 connections to different peers, 10 of
which are outbound. You can therefore, have at most 115 inbound connections.
Of the 10 outbound peers, there can be 8 full-relay connections and 2
block-relay-only ones.
Of the 10 outbound peers, there can be 8 outbound-full-relay connections and 2
outbound-block-relay ones.

The default settings can result in relatively significant traffic consumption.

Expand Down
2 changes: 1 addition & 1 deletion src/addrdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ bool CAddrDB::Read(CAddrMan& addr, CDataStream& ssPeers)

void DumpAnchors(const fs::path& anchors_db_path, const std::vector<CAddress>& anchors)
{
LOG_TIME_SECONDS(strprintf("Flush %d outbound block-relay-only peer addresses to anchors.dat", anchors.size()));
LOG_TIME_SECONDS(strprintf("Flush %d outbound-block-relay peer addresses to anchors.dat", anchors.size()));
SerializeFileDB("anchors", anchors_db_path, anchors);
}

Expand Down
2 changes: 1 addition & 1 deletion src/addrdb.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class CBanDB
/**
* Dump the anchor IP address database (anchors.dat)
*
* Anchors are last known outgoing block-relay-only peers that are
* Anchors are last known outbound-block-relay peers that are
* tried to re-connect to on startup.
*/
void DumpAnchors(const fs::path& anchors_db_path, const std::vector<CAddress>& anchors);
Expand Down
8 changes: 4 additions & 4 deletions src/bitcoin-cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ class NetinfoRequestHandler : public BaseRequestHandler
static constexpr uint8_t m_networks_size{4};
const std::array<std::string, m_networks_size> m_networks{{"ipv4", "ipv6", "onion", "i2p"}};
std::array<std::array<uint16_t, m_networks_size + 1>, 3> m_counts{{{}}}; //!< Peer counts by (in/out/total, networks/total)
uint8_t m_block_relay_peers_count{0};
uint8_t m_outbound_block_relay_peers_count{0};
uint8_t m_manual_peers_count{0};
int8_t NetworkStringToId(const std::string& str) const
{
Expand Down Expand Up @@ -361,7 +361,7 @@ class NetinfoRequestHandler : public BaseRequestHandler
std::string ConnectionTypeForNetinfo(const std::string& conn_type) const
{
if (conn_type == "outbound-full-relay") return "full";
if (conn_type == "block-relay-only") return "block";
if (conn_type == "outbound-block-relay") return "block";
if (conn_type == "manual" || conn_type == "feeler") return conn_type;
if (conn_type == "addr-fetch") return "addr";
return "";
Expand Down Expand Up @@ -479,7 +479,7 @@ class NetinfoRequestHandler : public BaseRequestHandler
++m_counts.at(is_outbound).at(m_networks_size); // in/out overall
++m_counts.at(2).at(network_id); // total by network
++m_counts.at(2).at(m_networks_size); // total overall
if (conn_type == "block-relay-only") ++m_block_relay_peers_count;
if (conn_type == "outbound-block-relay") ++m_outbound_block_relay_peers_count;
if (conn_type == "manual") ++m_manual_peers_count;
if (DetailsRequested()) {
// Push data for this peer to the peers vector.
Expand Down Expand Up @@ -553,7 +553,7 @@ class NetinfoRequestHandler : public BaseRequestHandler
if (m_is_i2p_on) result += strprintf(" %5i", m_counts.at(i).at(3)); // i2p peers count
result += strprintf(" %5i", m_counts.at(i).at(m_networks_size)); // total peers count
if (i == 1) { // the outbound row has two extra columns for block relay and manual peer counts
result += strprintf(" %5i", m_block_relay_peers_count);
result += strprintf(" %5i", m_outbound_block_relay_peers_count);
if (m_manual_peers_count) result += strprintf(" %5i", m_manual_peers_count);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ void Shutdown(NodeContext& node)
// using the other before destroying them.
if (node.peerman) UnregisterValidationInterface(node.peerman.get());
// Follow the lock order requirements:
// * CheckForStaleTipAndEvictPeers locks cs_main before indirectly calling GetExtraFullOutboundCount
// * CheckForStaleTipAndEvictPeers locks cs_main before indirectly calling GetExtraOutboundFullRelayCount
// which locks cs_vNodes.
// * ProcessMessage locks cs_main and g_cs_orphans before indirectly calling ForEachNode which
// locks cs_vNodes.
Expand Down Expand Up @@ -1916,7 +1916,7 @@ bool AppInitMain(const util::Ref& context, NodeContext& node, interfaces::BlockA
connOptions.nLocalServices = nLocalServices;
connOptions.nMaxConnections = nMaxConnections;
connOptions.m_max_outbound_full_relay = std::min(MAX_OUTBOUND_FULL_RELAY_CONNECTIONS, connOptions.nMaxConnections);
connOptions.m_max_outbound_block_relay = std::min(MAX_BLOCK_RELAY_ONLY_CONNECTIONS, connOptions.nMaxConnections-connOptions.m_max_outbound_full_relay);
connOptions.m_max_outbound_block_relay = std::min(MAX_OUTBOUND_BLOCK_RELAY_CONNECTIONS, connOptions.nMaxConnections-connOptions.m_max_outbound_full_relay);
connOptions.nMaxAddnode = MAX_ADDNODE_CONNECTIONS;
connOptions.nMaxFeeler = MAX_FEELER_CONNECTIONS;
connOptions.uiInterface = &uiInterface;
Expand Down
Loading