aboutsummaryrefslogtreecommitdiff
path: root/src/rpcnet.cpp
diff options
context:
space:
mode:
authorJonas Schnelli <jonas.schnelli@include7.ch>2015-06-26 21:38:33 +0200
committerJonas Schnelli <jonas.schnelli@include7.ch>2015-07-02 20:29:36 +0200
commit409bccfbf52b531b2a9d60ac2308f56223931a2e (patch)
treefb1f19b73ccad0f597fcd1dc3dc240843a728ccd /src/rpcnet.cpp
parentdfa174c2957f2600f05bf0ee9dd17fe18fb54fd7 (diff)
use CBanEntry as object container for banned nodes
- added a reason enum for a ban - added creation time for a ban Using CBanEntry as container will keep banlist.dat extenable.
Diffstat (limited to 'src/rpcnet.cpp')
-rw-r--r--src/rpcnet.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/rpcnet.cpp b/src/rpcnet.cpp
index 0c3745a7da..dd631905fd 100644
--- a/src/rpcnet.cpp
+++ b/src/rpcnet.cpp
@@ -515,7 +515,7 @@ UniValue setban(const UniValue& params, bool fHelp)
if (params.size() == 4 && params[3].isTrue())
absolute = true;
- isSubnet ? CNode::Ban(subNet, banTime, absolute) : CNode::Ban(netAddr, banTime, absolute);
+ isSubnet ? CNode::Ban(subNet, BanReasonManuallyAdded, banTime, absolute) : CNode::Ban(netAddr, BanReasonManuallyAdded, banTime, absolute);
//disconnect possible nodes
while(CNode *bannedNode = (isSubnet ? FindNode(subNet) : FindNode(netAddr)))
@@ -542,15 +542,19 @@ UniValue listbanned(const UniValue& params, bool fHelp)
+ HelpExampleRpc("listbanned", "")
);
- std::map<CSubNet, int64_t> banMap;
+ banmap_t banMap;
CNode::GetBanned(banMap);
UniValue bannedAddresses(UniValue::VARR);
- for (std::map<CSubNet, int64_t>::iterator it = banMap.begin(); it != banMap.end(); it++)
+ for (banmap_t::iterator it = banMap.begin(); it != banMap.end(); it++)
{
+ CBanEntry banEntry = (*it).second;
UniValue rec(UniValue::VOBJ);
rec.push_back(Pair("address", (*it).first.ToString()));
- rec.push_back(Pair("banned_untill", (*it).second));
+ rec.push_back(Pair("banned_until", banEntry.nBanUntil));
+ rec.push_back(Pair("ban_created", banEntry.nCreateTime));
+ rec.push_back(Pair("ban_reason", banEntry.banReasonToString()));
+
bannedAddresses.push_back(rec);
}