aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/unit_tests/ban.cpp13
-rw-r--r--tests/unit_tests/hardfork.cpp12
2 files changed, 18 insertions, 7 deletions
diff --git a/tests/unit_tests/ban.cpp b/tests/unit_tests/ban.cpp
index c8ce19ba4..0b267172f 100644
--- a/tests/unit_tests/ban.cpp
+++ b/tests/unit_tests/ban.cpp
@@ -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)
{
- 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)
diff --git a/tests/unit_tests/hardfork.cpp b/tests/unit_tests/hardfork.cpp
index bb26b5533..1d1e8e9c0 100644
--- a/tests/unit_tests/hardfork.cpp
+++ b/tests/unit_tests/hardfork.cpp
@@ -46,7 +46,7 @@ namespace
class TestDB: public cryptonote::BaseTestDB {
public:
- virtual uint64_t height() const { return blocks.size(); }
+ virtual uint64_t height() const override { return blocks.size(); }
virtual void add_block( const block& blk
, size_t block_weight
, uint64_t long_term_block_weight
@@ -54,19 +54,19 @@ public:
, const uint64_t& coins_generated
, uint64_t num_rct_outs
, const crypto::hash& blk_hash
- ) {
+ ) override {
blocks.push_back(blk);
}
- virtual void remove_block() { blocks.pop_back(); }
- virtual block get_block_from_height(const uint64_t& height) const {
+ virtual void remove_block() override { blocks.pop_back(); }
+ virtual block get_block_from_height(const uint64_t& height) const override {
return blocks.at(height);
}
- virtual void set_hard_fork_version(uint64_t height, uint8_t version) {
+ virtual void set_hard_fork_version(uint64_t height, uint8_t version) override {
if (versions.size() <= height)
versions.resize(height+1);
versions[height] = version;
}
- virtual uint8_t get_hard_fork_version(uint64_t height) const {
+ virtual uint8_t get_hard_fork_version(uint64_t height) const override {
return versions.at(height);
}