Compare commits

..

No commits in common. "6f8bce9b3a41ce9c9a73644f8a19840db22c25b2" and "512da314a5d3accd506813b5330e3d1c376d5628" have entirely different histories.

4 changed files with 15 additions and 23 deletions

View File

@ -7,6 +7,5 @@
# lite.hushpool.is # lite.hushpool.is
149.28.102.219 149.28.102.219
56wqzfj6mhxgsv3h3nh3pdocguogxfxud55libqjhjsdh5alfsko2iqd.onion # todo: torv3
# todo: i2p # todo: i2p

View File

@ -12,7 +12,6 @@ static const uint8_t chainparams_seed_main[] = {
0x01,0x04,0xb9,0xf1,0x3d,0x2b,0x00,0x00, // 185.241.61.43 0x01,0x04,0xb9,0xf1,0x3d,0x2b,0x00,0x00, // 185.241.61.43
0x01,0x04,0x89,0x4a,0x04,0xc6,0x00,0x00, // 137.74.4.198 0x01,0x04,0x89,0x4a,0x04,0xc6,0x00,0x00, // 137.74.4.198
0x01,0x04,0x95,0x1c,0x66,0xdb,0x00,0x00, // 149.28.102.219 0x01,0x04,0x95,0x1c,0x66,0xdb,0x00,0x00, // 149.28.102.219
0x04,0x20,0xef,0xad,0x0c,0x95,0x3e,0x61,0xee,0x69,0x57,0x67,0xdb,0x4f,0xb7,0x8d,0xc2,0x35,0x1c,0x6b,0x96,0xf4,0x1f,0x7a,0xb4,0x06,0x09,0x3a,0x64,0x33,0xf4,0x0b,0x2c,0x94,0x00,0x00, // 56wqzfj6mhxgsv3h3nh3pdocguogxfxud55libqjhjsdh5alfsko2iqd.onion
}; };
static const uint8_t chainparams_seed_test[] = { static const uint8_t chainparams_seed_test[] = {

View File

@ -604,7 +604,6 @@ void DumpBanlist()
if (bandb.Write(banmap)) { if (bandb.Write(banmap)) {
SetBannedSetDirty(false); SetBannedSetDirty(false);
} }
fprintf(stderr,"%s: Dumping banlist with %lu items\n", __func__, banmap.size());
LogPrint("net", "Flushed %d banned node ips/subnets to banlist.dat %dms\n", LogPrint("net", "Flushed %d banned node ips/subnets to banlist.dat %dms\n",
banmap.size(), GetTimeMillis() - nStart); banmap.size(), GetTimeMillis() - nStart);
@ -618,6 +617,7 @@ void CNode::ClearBanned()
setBannedIsDirty = true; setBannedIsDirty = true;
} }
DumpBanlist(); //store banlist to disk DumpBanlist(); //store banlist to disk
// uiInterface.BannedListChanged();
} }
@ -631,12 +631,10 @@ bool CNode::IsBanned(CNetAddr ip)
CSubNet subNet = (*it).first; CSubNet subNet = (*it).first;
CBanEntry banEntry = (*it).second; CBanEntry banEntry = (*it).second;
if(subNet.Match(ip) && GetTime() < banEntry.nBanUntil) { if(subNet.Match(ip) && GetTime() < banEntry.nBanUntil)
fprintf(stderr,"%s: found banned subnet %s\n", __func__, subNet.ToString().c_str());
fResult = true; fResult = true;
} }
} }
}
return fResult; return fResult;
} }
@ -666,30 +664,26 @@ void CNode::Ban(const CSubNet& subNet, const BanReason &banReason, int64_t banti
if (bantimeoffset > 0) if (bantimeoffset > 0)
banEntry.nBanUntil = (sinceUnixEpoch ? 0 : GetTime() )+bantimeoffset; banEntry.nBanUntil = (sinceUnixEpoch ? 0 : GetTime() )+bantimeoffset;
fprintf(stderr, "%s: banning %s until %ld with bantimeoffset=%ld sinceUnixEpoch=%d\n", __func__, subNet.ToString().c_str(), banEntry.nBanUntil, bantimeoffset, sinceUnixEpoch);
{ {
LOCK(cs_setBanned); LOCK(cs_setBanned);
if (setBanned[subNet].nBanUntil < banEntry.nBanUntil) { if (setBanned[subNet].nBanUntil < banEntry.nBanUntil) {
setBanned[subNet] = banEntry; setBanned[subNet] = banEntry;
setBannedIsDirty = true; setBannedIsDirty = true;
} else { }
else
return; return;
} }
} // uiInterface.BannedListChanged();
{ {
LOCK(cs_vNodes); LOCK(cs_vNodes);
for (CNode* pnode : vNodes) { for (CNode* pnode : vNodes) {
if (subNet.Match(static_cast<CNetAddr>(pnode->addr))) if (subNet.Match(static_cast<CNetAddr>(pnode->addr)))
fprintf(stderr, "%s: disconnecting from banned node %s\n", __func__, pnode->addr.ToString().c_str() );
pnode->fDisconnect = true; pnode->fDisconnect = true;
} }
} }
if(banReason == BanReasonManuallyAdded)
if(banReason == BanReasonManuallyAdded) {
fprintf(stderr,"%s: dumping banlist after manual ban\n", __func__);
DumpBanlist(); //store banlist to disk immediately if user requested ban DumpBanlist(); //store banlist to disk immediately if user requested ban
} }
}
bool CNode::Unban(const CNetAddr &addr) { bool CNode::Unban(const CNetAddr &addr) {
CSubNet subNet(addr); CSubNet subNet(addr);
@ -703,6 +697,7 @@ bool CNode::Unban(const CSubNet &subNet) {
return false; return false;
setBannedIsDirty = true; setBannedIsDirty = true;
} }
// uiInterface.BannedListChanged();
DumpBanlist(); //store banlist to disk immediately DumpBanlist(); //store banlist to disk immediately
return true; return true;
} }
@ -725,7 +720,6 @@ void SetBanned(const banmap_t &banMap)
void SweepBanned() void SweepBanned()
{ {
int64_t now = GetTime(); int64_t now = GetTime();
//fprintf(stderr,"%s: Sweeping banlist\n", __func__);
LOCK(cs_setBanned); LOCK(cs_setBanned);
banmap_t::iterator it = setBanned.begin(); banmap_t::iterator it = setBanned.begin();
@ -738,9 +732,9 @@ void SweepBanned()
setBanned.erase(it++); setBanned.erase(it++);
setBannedIsDirty = true; setBannedIsDirty = true;
LogPrint("net", "%s: Removed banned node ip/subnet from banlist.dat: %s\n", __func__, subNet.ToString()); LogPrint("net", "%s: Removed banned node ip/subnet from banlist.dat: %s\n", __func__, subNet.ToString());
} else {
++it;
} }
else
++it;
} }
} }

View File

@ -633,7 +633,7 @@ UniValue setban(const UniValue& params, bool fHelp, const CPubKey& mypk)
if (isSubnet ? CNode::IsBanned(subNet) : CNode::IsBanned(netAddr)) if (isSubnet ? CNode::IsBanned(subNet) : CNode::IsBanned(netAddr))
throw JSONRPCError(RPC_CLIENT_NODE_ALREADY_ADDED, "Error: IP/Subnet already banned"); throw JSONRPCError(RPC_CLIENT_NODE_ALREADY_ADDED, "Error: IP/Subnet already banned");
int64_t banTime = 60*60*24; //use standard bantime if not specified int64_t banTime = 0; //use standard bantime if not specified
if (params.size() >= 3 && !params[2].isNull()) if (params.size() >= 3 && !params[2].isNull())
banTime = params[2].get_int64(); banTime = params[2].get_int64();
@ -641,14 +641,14 @@ UniValue setban(const UniValue& params, bool fHelp, const CPubKey& mypk)
if (params.size() == 4 && params[3].isTrue()) if (params.size() == 4 && params[3].isTrue())
absolute = true; absolute = true;
fprintf(stderr,"%s: adding manual ban for %s with banTime=%ld absolute=%d isSubnet=%d\n", __func__, isSubnet ? subNet.ToString().c_str() : netAddr.ToString().c_str(), banTime, absolute, isSubnet);
isSubnet ? CNode::Ban(subNet, BanReasonManuallyAdded, banTime, absolute) : CNode::Ban(netAddr, BanReasonManuallyAdded, banTime, absolute); isSubnet ? CNode::Ban(subNet, BanReasonManuallyAdded, banTime, absolute) : CNode::Ban(netAddr, BanReasonManuallyAdded, banTime, absolute);
//disconnect possible nodes //disconnect possible nodes
while(CNode *bannedNode = (isSubnet ? FindNode(subNet) : FindNode(netAddr))) { while(CNode *bannedNode = (isSubnet ? FindNode(subNet) : FindNode(netAddr)))
bannedNode->fDisconnect = true; bannedNode->fDisconnect = true;
} }
} else if(strCommand == "remove") { else if(strCommand == "remove")
{
if (!( isSubnet ? CNode::Unban(subNet) : CNode::Unban(netAddr) )) if (!( isSubnet ? CNode::Unban(subNet) : CNode::Unban(netAddr) ))
throw JSONRPCError(RPC_MISC_ERROR, "Error: Unban failed"); throw JSONRPCError(RPC_MISC_ERROR, "Error: Unban failed");
} }