mirror of
https://github.com/kvazar-network/kevacoin.git
synced 2025-01-11 15:48:05 +00:00
gui: fix ban from qt console
Rather than doing a circle and re-resolving the node's IP, just use the one from nodestats directly. This requires syncing the addr field from CNode.
This commit is contained in:
parent
d7615af34e
commit
cb78c60534
@ -629,6 +629,7 @@ void CNode::copyStats(CNodeStats &stats)
|
|||||||
{
|
{
|
||||||
stats.nodeid = this->GetId();
|
stats.nodeid = this->GetId();
|
||||||
X(nServices);
|
X(nServices);
|
||||||
|
X(addr);
|
||||||
X(fRelayTxes);
|
X(fRelayTxes);
|
||||||
X(nLastSend);
|
X(nLastSend);
|
||||||
X(nLastRecv);
|
X(nLastRecv);
|
||||||
|
@ -505,6 +505,7 @@ public:
|
|||||||
double dPingWait;
|
double dPingWait;
|
||||||
double dPingMin;
|
double dPingMin;
|
||||||
std::string addrLocal;
|
std::string addrLocal;
|
||||||
|
CAddress addr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -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();
|
|
||||||
// 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))
|
|
||||||
return;
|
return;
|
||||||
g_connman->Ban(resolved, BanReasonManuallyAdded, bantime);
|
|
||||||
clearSelectedNode();
|
// Get currently selected peer address
|
||||||
clientModel->getBanTableModel()->refresh();
|
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()
|
void RPCConsole::unbanSelectedNode()
|
||||||
|
Loading…
Reference in New Issue
Block a user