aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/net.cpp1
-rw-r--r--src/net.h1
-rw-r--r--src/qt/rpcconsole.cpp25
3 files changed, 15 insertions, 12 deletions
diff --git a/src/net.cpp b/src/net.cpp
index 770e2d2959..19dd040997 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -629,6 +629,7 @@ void CNode::copyStats(CNodeStats &stats)
{
stats.nodeid = this->GetId();
X(nServices);
+ X(addr);
X(fRelayTxes);
X(nLastSend);
X(nLastRecv);
diff --git a/src/net.h b/src/net.h
index d0b2773623..67f0abe4be 100644
--- a/src/net.h
+++ b/src/net.h
@@ -505,6 +505,7 @@ public:
double dPingWait;
double dPingMin;
std::string addrLocal;
+ CAddress addr;
};
diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp
index ace9f1ceaa..b6ed75535c 100644
--- a/src/qt/rpcconsole.cpp
+++ b/src/qt/rpcconsole.cpp
@@ -981,20 +981,21 @@ void RPCConsole::banSelectedNode(int bantime)
if (!clientModel || !g_connman)
return;
- // Get currently selected peer address
- QString strNode = GUIUtil::getEntryData(ui->peerWidget, 0, PeerTableModel::Address).toString();
- // Find possible nodes, ban it and clear the selected node
- std::string nStr = strNode.toStdString();
- std::string addr;
- int port = 0;
- SplitHostPort(nStr, port, addr);
+ if(cachedNodeid == -1)
+ return;
- CNetAddr resolved;
- if(!LookupHost(addr.c_str(), resolved, false))
+ // Get currently selected peer address
+ int detailNodeRow = clientModel->getPeerTableModel()->getRowByNodeId(cachedNodeid);
+ if(detailNodeRow < 0)
return;
- g_connman->Ban(resolved, BanReasonManuallyAdded, bantime);
- clearSelectedNode();
- clientModel->getBanTableModel()->refresh();
+
+ // Find possible nodes, ban it and clear the selected node
+ const CNodeCombinedStats *stats = clientModel->getPeerTableModel()->getNodeStats(detailNodeRow);
+ if(stats) {
+ g_connman->Ban(stats->nodeStats.addr, BanReasonManuallyAdded, bantime);
+ clearSelectedNode();
+ clientModel->getBanTableModel()->refresh();
+ }
}
void RPCConsole::unbanSelectedNode()