|
|
@ -981,20 +981,21 @@ void RPCConsole::banSelectedNode(int bantime) |
|
|
|
if (!clientModel || !g_connman) |
|
|
|
if (!clientModel || !g_connman) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
// Get currently selected peer address
|
|
|
|
if(cachedNodeid == -1) |
|
|
|
QString strNode = GUIUtil::getEntryData(ui->peerWidget, 0, PeerTableModel::Address).toString(); |
|
|
|
return; |
|
|
|
// 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); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CNetAddr resolved; |
|
|
|
// Get currently selected peer address
|
|
|
|
if(!LookupHost(addr.c_str(), resolved, false)) |
|
|
|
int detailNodeRow = clientModel->getPeerTableModel()->getRowByNodeId(cachedNodeid); |
|
|
|
|
|
|
|
if(detailNodeRow < 0) |
|
|
|
return; |
|
|
|
return; |
|
|
|
g_connman->Ban(resolved, BanReasonManuallyAdded, bantime); |
|
|
|
|
|
|
|
clearSelectedNode(); |
|
|
|
// Find possible nodes, ban it and clear the selected node
|
|
|
|
clientModel->getBanTableModel()->refresh(); |
|
|
|
const CNodeCombinedStats *stats = clientModel->getPeerTableModel()->getNodeStats(detailNodeRow); |
|
|
|
|
|
|
|
if(stats) { |
|
|
|
|
|
|
|
g_connman->Ban(stats->nodeStats.addr, BanReasonManuallyAdded, bantime); |
|
|
|
|
|
|
|
clearSelectedNode(); |
|
|
|
|
|
|
|
clientModel->getBanTableModel()->refresh(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void RPCConsole::unbanSelectedNode() |
|
|
|
void RPCConsole::unbanSelectedNode() |
|
|
|