aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/interfaces/node.h3
-rw-r--r--src/net.cpp7
-rw-r--r--src/net.h1
-rw-r--r--src/node/interfaces.cpp7
-rw-r--r--src/qt/clientmodel.cpp7
-rw-r--r--src/qt/clientmodel.h4
-rw-r--r--src/qt/forms/debugwindow.ui57
-rw-r--r--src/qt/rpcconsole.cpp12
8 files changed, 87 insertions, 11 deletions
diff --git a/src/interfaces/node.h b/src/interfaces/node.h
index b9b2306ce3..81844c6185 100644
--- a/src/interfaces/node.h
+++ b/src/interfaces/node.h
@@ -171,6 +171,9 @@ public:
//! Get num blocks.
virtual int getNumBlocks() = 0;
+ //! Get network local addresses.
+ virtual std::map<CNetAddr, LocalServiceInfo> getNetLocalAddresses() = 0;
+
//! Get best block hash.
virtual uint256 getBestBlockHash() = 0;
diff --git a/src/net.cpp b/src/net.cpp
index 3d3f9f4ba7..4ade0a1889 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -3550,6 +3550,13 @@ size_t CConnman::GetNodeCount(ConnectionDirection flags) const
return nNum;
}
+
+std::map<CNetAddr, LocalServiceInfo> CConnman::getNetLocalAddresses() const
+{
+ LOCK(g_maplocalhost_mutex);
+ return mapLocalHost;
+}
+
uint32_t CConnman::GetMappedAS(const CNetAddr& addr) const
{
return m_netgroupman.GetMappedAS(addr);
diff --git a/src/net.h b/src/net.h
index a4e4b50360..8449a90b72 100644
--- a/src/net.h
+++ b/src/net.h
@@ -1205,6 +1205,7 @@ public:
bool AddConnection(const std::string& address, ConnectionType conn_type, bool use_v2transport) EXCLUSIVE_LOCKS_REQUIRED(!m_unused_i2p_sessions_mutex);
size_t GetNodeCount(ConnectionDirection) const;
+ std::map<CNetAddr, LocalServiceInfo> getNetLocalAddresses() const;
uint32_t GetMappedAS(const CNetAddr& addr) const;
void GetNodeStats(std::vector<CNodeStats>& vstats) const;
bool DisconnectNode(const std::string& node);
diff --git a/src/node/interfaces.cpp b/src/node/interfaces.cpp
index 46d36f83f8..9fe08eb3dd 100644
--- a/src/node/interfaces.cpp
+++ b/src/node/interfaces.cpp
@@ -290,6 +290,13 @@ public:
}
return false;
}
+ std::map<CNetAddr, LocalServiceInfo> getNetLocalAddresses() override
+ {
+ if (m_context->connman)
+ return m_context->connman->getNetLocalAddresses();
+ else
+ return {};
+ }
int getNumBlocks() override
{
LOCK(::cs_main);
diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp
index 0b03e3071c..5c70c2695c 100644
--- a/src/qt/clientmodel.cpp
+++ b/src/qt/clientmodel.cpp
@@ -123,6 +123,13 @@ int64_t ClientModel::getHeaderTipTime() const
return cachedBestHeaderTime;
}
+
+std::map<CNetAddr, LocalServiceInfo> ClientModel::getNetLocalAddresses() const
+{
+ return m_node.getNetLocalAddresses();
+}
+
+
int ClientModel::getNumBlocks() const
{
if (m_cached_num_blocks == -1) {
diff --git a/src/qt/clientmodel.h b/src/qt/clientmodel.h
index 7727359f99..7d0e35e7f9 100644
--- a/src/qt/clientmodel.h
+++ b/src/qt/clientmodel.h
@@ -13,12 +13,15 @@
#include <sync.h>
#include <uint256.h>
+#include <netaddress.h>
+
class BanTableModel;
class CBlockIndex;
class OptionsModel;
class PeerTableModel;
class PeerTableSortProxy;
enum class SynchronizationState;
+struct LocalServiceInfo;
namespace interfaces {
class Handler;
@@ -68,6 +71,7 @@ public:
//! Return number of connections, default is in- and outbound (total)
int getNumConnections(unsigned int flags = CONNECTIONS_ALL) const;
+ std::map<CNetAddr, LocalServiceInfo> getNetLocalAddresses() const;
int getNumBlocks() const;
uint256 getBestBlockHash() EXCLUSIVE_LOCKS_REQUIRED(!m_cached_tip_mutex);
int getHeaderTipHeight() const;
diff --git a/src/qt/forms/debugwindow.ui b/src/qt/forms/debugwindow.ui
index 10c923db72..eccea14318 100644
--- a/src/qt/forms/debugwindow.ui
+++ b/src/qt/forms/debugwindow.ui
@@ -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>
diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp
index 8735f9637f..ae3f9aa686 100644
--- a/src/qt/rpcconsole.cpp
+++ b/src/qt/rpcconsole.cpp
@@ -978,6 +978,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)