unit_tests: undo is_blocked implementation factoring

The is_host_blocked method is not on master yet
This commit is contained in:
moneromooo-monero 2019-04-16 22:23:15 +00:00
parent 37c4f1b365
commit e3dea47859
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3

View file

@ -93,7 +93,18 @@ typedef nodetool::node_server<cryptonote::t_cryptonote_protocol_handler<test_cor
static bool is_blocked(Server &server, const epee::net_utils::network_address &address, time_t *t = NULL) static bool is_blocked(Server &server, const epee::net_utils::network_address &address, time_t *t = NULL)
{ {
return server.is_host_blocked(address.host_str(), t); const std::string host = address.host_str();
std::map<std::string, time_t> hosts = server.get_blocked_hosts();
for (auto rec: hosts)
{
if (rec.first == host)
{
if (t)
*t = rec.second;
return true;
}
}
return false;
} }
TEST(ban, add) TEST(ban, add)