Skip to content

Commit

Permalink
Fix GUI banning
Browse files Browse the repository at this point in the history
Fix whitespace
  • Loading branch information
Liquid369 committed May 2, 2023
1 parent 38df19c commit a86ab9e
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/qt/rpcconsole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -808,15 +808,24 @@ void RPCConsole::banSelectedNode(int bantime)
if (!clientModel || !g_connman)
return;

// No node selected exit out
if (cachedNodeid == -1)
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();
int selectedNodeRow = clientModel->getPeerTableModel()->getRowByNodeId(cachedNodeid);
if (selectedNodeRow < 0)
return;

// Get nodeStats and we will use the addrName string(ip address)
const CNodeCombinedStats* stats = clientModel->getPeerTableModel()->getNodeStats(selectedNodeRow);

std::string nStr = stats->nodeStats.addrName;
std::string addr;
int port = 0;
SplitHostPort(nStr, port, addr);

CNetAddr resolved;

if (!LookupHost(addr.c_str(), resolved, false))
return;
g_connman->Ban(resolved, BanReasonManuallyAdded, bantime);
Expand Down

0 comments on commit a86ab9e

Please sign in to comment.