Merge #8885: gui: fix ban from qt console

cb78c60 gui: fix ban from qt console (Cory Fields)
This commit is contained in:
Jonas Schnelli 2016-10-08 16:43:11 +02:00
commit b2fec4e9a1
No known key found for this signature in database
GPG key ID: 29D4BCB6416F53EC
3 changed files with 16 additions and 13 deletions

View file

@ -629,6 +629,7 @@ void CNode::copyStats(CNodeStats &stats)
{
stats.nodeid = this->GetId();
X(nServices);
X(addr);
X(fRelayTxes);
X(nLastSend);
X(nLastRecv);

View file

@ -505,6 +505,7 @@ public:
double dPingWait;
double dPingMin;
std::string addrLocal;
CAddress addr;
};

View file

@ -981,21 +981,22 @@ 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);
CNetAddr resolved;
if(!LookupHost(addr.c_str(), resolved, false))
if(cachedNodeid == -1)
return;
g_connman->Ban(resolved, BanReasonManuallyAdded, bantime);
// Get currently selected peer address
int detailNodeRow = clientModel->getPeerTableModel()->getRowByNodeId(cachedNodeid);
if(detailNodeRow < 0)
return;
// 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()
{