0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-03-05 14:06:27 -05:00

Showing local addresses on the Node Window

Adds a new row to the Node Window (debugwindow.ui)
under the Network section which shows the LocalAddresses.

fixes #564
This commit is contained in:
Jadi 2024-05-23 17:45:57 +03:30
parent a5d7aff867
commit 189c987386
2 changed files with 58 additions and 11 deletions

View file

@ -249,6 +249,41 @@
</widget>
</item>
<item row="9" column="0">
<widget class="QLabel" name="label_14">
<property name="text">
<string>Local Addresses</string>
</property>
</widget>
</item>
<item row="9" column="1" colspan="2">
<widget class="QLabel" name="localAddresses">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">N/A</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
<property name="toolTip">
<string>Network addresses that your Bitcoin node is currently using to communicate with other nodes.</string>
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QLabel" name="label_10">
<property name="font">
<font>
@ -261,14 +296,14 @@
</property>
</widget>
</item>
<item row="10" column="0">
<item row="11" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Current block height</string>
</property>
</widget>
</item>
<item row="10" column="1" colspan="2">
<item row="11" column="1" colspan="2">
<widget class="QLabel" name="numberOfBlocks">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
@ -284,14 +319,14 @@
</property>
</widget>
</item>
<item row="11" column="0">
<item row="12" column="0">
<widget class="QLabel" name="labelLastBlockTime">
<property name="text">
<string>Last block time</string>
</property>
</widget>
</item>
<item row="11" column="1" colspan="2">
<item row="12" column="1" colspan="2">
<widget class="QLabel" name="lastBlockTime">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
@ -307,7 +342,7 @@
</property>
</widget>
</item>
<item row="12" column="0">
<item row="13" column="0">
<widget class="QLabel" name="labelMempoolTitle">
<property name="font">
<font>
@ -320,14 +355,14 @@
</property>
</widget>
</item>
<item row="13" column="0">
<item row="14" column="0">
<widget class="QLabel" name="labelNumberOfTransactions">
<property name="text">
<string>Current number of transactions</string>
</property>
</widget>
</item>
<item row="13" column="1">
<item row="14" column="1">
<widget class="QLabel" name="mempoolNumberTxs">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
@ -343,14 +378,14 @@
</property>
</widget>
</item>
<item row="14" column="0">
<item row="15" column="0">
<widget class="QLabel" name="labelMemoryUsage">
<property name="text">
<string>Memory usage</string>
</property>
</widget>
</item>
<item row="14" column="1">
<item row="15" column="1">
<widget class="QLabel" name="mempoolSize">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
@ -366,7 +401,7 @@
</property>
</widget>
</item>
<item row="12" column="2" rowspan="3">
<item row="13" column="2" rowspan="3">
<layout class="QVBoxLayout" name="verticalLayoutDebugButton">
<property name="spacing">
<number>3</number>
@ -406,7 +441,7 @@
</item>
</layout>
</item>
<item row="15" column="0">
<item row="16" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>

View file

@ -975,6 +975,18 @@ void RPCConsole::updateNetworkState()
}
ui->numberOfConnections->setText(connections);
QString local_addresses;
std::map<CNetAddr, LocalServiceInfo> hosts = clientModel->getNetLocalAddresses();
for (const auto& [addr, info] : hosts) {
local_addresses += QString::fromStdString(addr.ToStringAddr());
if (!addr.IsI2P()) local_addresses += ":" + QString::number(info.nPort);
local_addresses += ", ";
}
local_addresses.chop(2); // remove last ", "
if (local_addresses.isEmpty()) local_addresses = tr("None");
ui->localAddresses->setText(local_addresses);
}
void RPCConsole::setNumConnections(int count)