File tree Expand file tree Collapse file tree 3 files changed +15
-12
lines changed Expand file tree Collapse file tree 3 files changed +15
-12
lines changed Original file line number Diff line number Diff line change @@ -629,6 +629,7 @@ void CNode::copyStats(CNodeStats &stats)
629629{
630630 stats.nodeid = this ->GetId ();
631631 X (nServices);
632+ X (addr);
632633 X (fRelayTxes );
633634 X (nLastSend);
634635 X (nLastRecv);
Original file line number Diff line number Diff line change @@ -505,6 +505,7 @@ class CNodeStats
505505 double dPingWait;
506506 double dPingMin;
507507 std::string addrLocal;
508+ CAddress addr;
508509};
509510
510511
Original file line number Diff line number Diff line change @@ -981,20 +981,21 @@ void RPCConsole::banSelectedNode(int bantime)
981981 if (!clientModel || !g_connman)
982982 return ;
983983
984- // Get currently selected peer address
985- QString strNode = GUIUtil::getEntryData (ui->peerWidget , 0 , PeerTableModel::Address).toString ();
986- // Find possible nodes, ban it and clear the selected node
987- std::string nStr = strNode.toStdString ();
988- std::string addr;
989- int port = 0 ;
990- SplitHostPort (nStr, port, addr);
984+ if (cachedNodeid == -1 )
985+ return ;
991986
992- CNetAddr resolved;
993- if (!LookupHost (addr.c_str (), resolved, false ))
987+ // Get currently selected peer address
988+ int detailNodeRow = clientModel->getPeerTableModel ()->getRowByNodeId (cachedNodeid);
989+ if (detailNodeRow < 0 )
994990 return ;
995- g_connman->Ban (resolved, BanReasonManuallyAdded, bantime);
996- clearSelectedNode ();
997- clientModel->getBanTableModel ()->refresh ();
991+
992+ // Find possible nodes, ban it and clear the selected node
993+ const CNodeCombinedStats *stats = clientModel->getPeerTableModel ()->getNodeStats (detailNodeRow);
994+ if (stats) {
995+ g_connman->Ban (stats->nodeStats .addr , BanReasonManuallyAdded, bantime);
996+ clearSelectedNode ();
997+ clientModel->getBanTableModel ()->refresh ();
998+ }
998999}
9991000
10001001void RPCConsole::unbanSelectedNode ()
You can’t perform that action at this time.
0 commit comments