aboutsummaryrefslogtreecommitdiff
path: root/src/qt/rpcconsole.cpp
diff options
context:
space:
mode:
authorCory Fields <cory-nospam-@coryfields.com>2016-04-16 17:43:11 -0400
committerCory Fields <cory-nospam-@coryfields.com>2016-09-08 12:12:57 -0400
commita0f3d3cdad630103d919a4ec802c413b87fa1f1a (patch)
treeb02339d74322cb6e6243a4b1bba743a374f4f439 /src/qt/rpcconsole.cpp
parentaaf018e3b79417ecfd39291a8c100df77969d77a (diff)
net: move ban and addrman functions into CConnman
Diffstat (limited to 'src/qt/rpcconsole.cpp')
-rw-r--r--src/qt/rpcconsole.cpp29
1 files changed, 13 insertions, 16 deletions
diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp
index e5720dd70e..708be6b646 100644
--- a/src/qt/rpcconsole.cpp
+++ b/src/qt/rpcconsole.cpp
@@ -887,26 +887,23 @@ void RPCConsole::disconnectSelectedNode()
void RPCConsole::banSelectedNode(int bantime)
{
- if (!clientModel)
+ 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
- if (FindNode(strNode.toStdString())) {
- 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;
- CNode::Ban(resolved, BanReasonManuallyAdded, bantime);
+ std::string nStr = strNode.toStdString();
+ std::string addr;
+ int port = 0;
+ SplitHostPort(nStr, port, addr);
- clearSelectedNode();
- clientModel->getBanTableModel()->refresh();
- }
+ CNetAddr resolved;
+ if(!LookupHost(addr.c_str(), resolved, false))
+ return;
+ g_connman->Ban(resolved, BanReasonManuallyAdded, bantime);
+ clearSelectedNode();
+ clientModel->getBanTableModel()->refresh();
}
void RPCConsole::unbanSelectedNode()
@@ -919,9 +916,9 @@ void RPCConsole::unbanSelectedNode()
CSubNet possibleSubnet;
LookupSubNet(strNode.toStdString().c_str(), possibleSubnet);
- if (possibleSubnet.IsValid())
+ if (possibleSubnet.IsValid() && g_connman)
{
- CNode::Unban(possibleSubnet);
+ g_connman->Unban(possibleSubnet);
clientModel->getBanTableModel()->refresh();
}
}