Skip to content

Commit 582c6ec

Browse files
committed
merge bitcoin-core/gui#180: connection type follow-ups
1 parent d7413ff commit 582c6ec

File tree

5 files changed

+26
-13
lines changed

5 files changed

+26
-13
lines changed

src/net.h

+6-5
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,8 @@ struct CSerializedNetMsg
148148
* connection. Aside from INBOUND, all types are initiated by us.
149149
*
150150
* If adding or removing types, please update CONNECTION_TYPE_DOC in
151-
* src/rpc/net.cpp. */
151+
* src/rpc/net.cpp and src/qt/rpcconsole.cpp, as well as the descriptions in
152+
* src/qt/guiutil.cpp and src/bitcoin-cli.cpp::NetinfoRequestHandler. */
152153
enum class ConnectionType {
153154
/**
154155
* Inbound connections are those initiated by a peer. This is the only
@@ -159,16 +160,16 @@ enum class ConnectionType {
159160

160161
/**
161162
* These are the default connections that we use to connect with the
162-
* network. There is no restriction on what is relayed- by default we relay
163+
* network. There is no restriction on what is relayed; by default we relay
163164
* blocks, addresses & transactions. We automatically attempt to open
164165
* MAX_OUTBOUND_FULL_RELAY_CONNECTIONS using addresses from our AddrMan.
165166
*/
166167
OUTBOUND_FULL_RELAY,
167168

168169

169170
/**
170-
* We open manual connections to addresses that users explicitly inputted
171-
* via the addnode RPC, or the -connect command line argument. Even if a
171+
* We open manual connections to addresses that users explicitly requested
172+
* via the addnode RPC or the -addnode/-connect configuration options. Even if a
172173
* manual connection is misbehaving, we do not automatically disconnect or
173174
* add it to our discouragement filter.
174175
*/
@@ -187,7 +188,7 @@ enum class ConnectionType {
187188
* although in our codebase feeler connections encompass test-before-evict as well.
188189
* We make these connections approximately every FEELER_INTERVAL:
189190
* first we resolve previously found collisions if they exist (test-before-evict),
190-
* otherwise connect to a node from the new table.
191+
* otherwise we connect to a node from the new table.
191192
*/
192193
FEELER,
193194

src/qt/forms/debugwindow.ui

+1-1
Original file line numberDiff line numberDiff line change
@@ -1028,7 +1028,7 @@
10281028
<item row="4" column="0">
10291029
<widget class="QLabel" name="peerConnectionTypeLabel">
10301030
<property name="toolTip">
1031-
<string>The type of peer connection:&lt;ul&gt;&lt;li&gt;Inbound: initiated by peer&lt;/li&gt;&lt;li&gt;Outbound Full Relay: default&lt;/li&gt;&lt;li&gt;Outbound Block Relay: does not relay transactions or addresses&lt;/li&gt;&lt;li&gt;Outbound Manual: added using RPC %1 or %2/%3 configuration options&lt;/li&gt;&lt;li&gt;Outbound Feeler: short-lived, for testing addresses&lt;/li&gt;&lt;li&gt;Outbound Address Fetch: short-lived, for soliciting addresses&lt;/li&gt;&lt;/ul&gt;</string>
1031+
<string>The type of peer connection: %1</string>
10321032
</property>
10331033
<property name="text">
10341034
<string>Connection Type</string>

src/qt/guiutil.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1661,10 +1661,10 @@ QString NetworkToQString(Network net)
16611661
assert(false);
16621662
}
16631663

1664-
QString ConnectionTypeToQString(ConnectionType conn_type)
1664+
QString ConnectionTypeToQString(ConnectionType conn_type, bool relay_txes)
16651665
{
16661666
switch (conn_type) {
1667-
case ConnectionType::INBOUND: return QObject::tr("Inbound");
1667+
case ConnectionType::INBOUND: return relay_txes ? QObject::tr("Inbound Full Relay") : QObject::tr("Inbound Block Relay");
16681668
case ConnectionType::OUTBOUND_FULL_RELAY: return QObject::tr("Outbound Full Relay");
16691669
case ConnectionType::BLOCK_RELAY: return QObject::tr("Outbound Block Relay");
16701670
case ConnectionType::MANUAL: return QObject::tr("Outbound Manual");

src/qt/guiutil.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ namespace GUIUtil
398398
QString NetworkToQString(Network net);
399399

400400
/** Convert enum ConnectionType to QString */
401-
QString ConnectionTypeToQString(ConnectionType conn_type);
401+
QString ConnectionTypeToQString(ConnectionType conn_type, bool relay_txes);
402402

403403
/** Convert seconds into a QString with days, hours, mins, secs */
404404
QString formatDurationStr(std::chrono::seconds dur);

src/qt/rpcconsole.cpp

+16-4
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@
1818
#include <chainparams.h>
1919
#include <interfaces/node.h>
2020
#include <netbase.h>
21-
#include <rpc/server.h>
2221
#include <rpc/client.h>
22+
#include <rpc/server.h>
2323
#include <util/strencodings.h>
24+
#include <util/string.h>
2425
#include <util/system.h>
2526
#include <util/threadnames.h>
2627
#include <util/underlying.h>
@@ -476,11 +477,22 @@ RPCConsole::RPCConsole(interfaces::Node& node, QWidget* parent, Qt::WindowFlags
476477

477478
ui->splitter->restoreState(settings.value("PeersTabSplitterSizes").toByteArray());
478479

479-
QChar nonbreaking_hyphen(8209);
480+
constexpr QChar nonbreaking_hyphen(8209);
481+
const std::vector<QString> CONNECTION_TYPE_DOC{
482+
tr("Inbound Full/Block Relay: initiated by peer"),
483+
tr("Outbound Full Relay: default"),
484+
tr("Outbound Block Relay: does not relay transactions or addresses"),
485+
tr("Outbound Manual: added using RPC %1 or %2/%3 configuration options")
486+
.arg("addnode")
487+
.arg(QString(nonbreaking_hyphen) + "addnode")
488+
.arg(QString(nonbreaking_hyphen) + "connect"),
489+
tr("Outbound Feeler: short-lived, for testing addresses"),
490+
tr("Outbound Address Fetch: short-lived, for soliciting addresses")};
491+
const QString list{"<ul><li>" + Join(CONNECTION_TYPE_DOC, QString("</li><li>")) + "</li></ul>"};
492+
ui->peerConnectionTypeLabel->setToolTip(ui->peerConnectionTypeLabel->toolTip().arg(list));
480493
ui->dataDir->setToolTip(ui->dataDir->toolTip().arg(QString(nonbreaking_hyphen) + "datadir"));
481494
ui->blocksDir->setToolTip(ui->blocksDir->toolTip().arg(QString(nonbreaking_hyphen) + "blocksdir"));
482495
ui->openDebugLogfileButton->setToolTip(ui->openDebugLogfileButton->toolTip().arg(PACKAGE_NAME));
483-
ui->peerConnectionTypeLabel->setToolTip(ui->peerConnectionTypeLabel->toolTip().arg("addnode").arg(QString(nonbreaking_hyphen) + "addnode").arg(QString(nonbreaking_hyphen) + "connect"));
484496

485497
setButtonIcons();
486498

@@ -1241,7 +1253,7 @@ void RPCConsole::updateDetailWidget()
12411253
ui->timeoffset->setText(GUIUtil::formatTimeOffset(stats->nodeStats.nTimeOffset));
12421254
ui->peerVersion->setText(QString::number(stats->nodeStats.nVersion));
12431255
ui->peerSubversion->setText(QString::fromStdString(stats->nodeStats.cleanSubVer));
1244-
ui->peerConnectionType->setText(GUIUtil::ConnectionTypeToQString(stats->nodeStats.m_conn_type));
1256+
ui->peerConnectionType->setText(GUIUtil::ConnectionTypeToQString(stats->nodeStats.m_conn_type, stats->nodeStats.fRelayTxes));
12451257
ui->peerNetwork->setText(GUIUtil::NetworkToQString(stats->nodeStats.m_network));
12461258
if (stats->nodeStats.m_permissionFlags == NetPermissionFlags::None) {
12471259
ui->peerPermissions->setText(tr("N/A"));

0 commit comments

Comments
 (0)