aboutsummaryrefslogtreecommitdiff
path: root/tests/unit_tests/long_term_block_weight.cpp
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-11-11 14:51:03 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-03-05 11:57:55 +0000
commitb044d03a51e1dc64bebe2461813e0cfc50f71b0d (patch)
treec0efdbeae2f8ed76e9ac628556ff119fe195e5dc /tests/unit_tests/long_term_block_weight.cpp
parentwallet2: don't calculate prefix hash when we don't need it (diff)
downloadmonero-b044d03a51e1dc64bebe2461813e0cfc50f71b0d.tar.xz
Avoid repeated (de)serialization when syncing
Diffstat (limited to 'tests/unit_tests/long_term_block_weight.cpp')
-rw-r--r--tests/unit_tests/long_term_block_weight.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/tests/unit_tests/long_term_block_weight.cpp b/tests/unit_tests/long_term_block_weight.cpp
index 0ee6c5c2b..113b01865 100644
--- a/tests/unit_tests/long_term_block_weight.cpp
+++ b/tests/unit_tests/long_term_block_weight.cpp
@@ -123,7 +123,7 @@ TEST(long_term_block_weight, identical_before_fork)
{
size_t w = h < CRYPTONOTE_REWARD_BLOCKS_WINDOW ? CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V5 : bc->get_current_cumulative_block_weight_limit();
uint64_t ltw = bc->get_next_long_term_block_weight(w);
- bc->get_db().add_block(cryptonote::block(), w, ltw, h, h, {});
+ bc->get_db().add_block(std::make_pair(cryptonote::block(), ""), w, ltw, h, h, {});
ASSERT_TRUE(bc->update_next_cumulative_weight_limit());
}
for (uint64_t h = 0; h < 10 * TEST_LONG_TERM_BLOCK_WEIGHT_WINDOW; ++h)
@@ -140,7 +140,7 @@ TEST(long_term_block_weight, identical_after_fork_before_long_term_window)
{
size_t w = h < TEST_LONG_TERM_BLOCK_WEIGHT_WINDOW ? CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V5 : bc->get_current_cumulative_block_weight_limit();
uint64_t ltw = bc->get_next_long_term_block_weight(w);
- bc->get_db().add_block(cryptonote::block(), w, ltw, h, h, {});
+ bc->get_db().add_block(std::make_pair(cryptonote::block(), ""), w, ltw, h, h, {});
ASSERT_TRUE(bc->update_next_cumulative_weight_limit());
}
for (uint64_t h = 0; h < TEST_LONG_TERM_BLOCK_WEIGHT_WINDOW; ++h)
@@ -157,7 +157,7 @@ TEST(long_term_block_weight, ceiling_at_30000000)
{
size_t w = h < TEST_LONG_TERM_BLOCK_WEIGHT_WINDOW ? CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V5 : bc->get_current_cumulative_block_weight_limit();
uint64_t ltw = bc->get_next_long_term_block_weight(w);
- bc->get_db().add_block(cryptonote::block(), w, ltw, h, h, {});
+ bc->get_db().add_block(std::make_pair(cryptonote::block(), ""), w, ltw, h, h, {});
ASSERT_TRUE(bc->update_next_cumulative_weight_limit());
}
ASSERT_EQ(bc->get_current_cumulative_block_weight_median(), 15000000);
@@ -172,7 +172,7 @@ TEST(long_term_block_weight, multi_pop)
{
size_t w = h < TEST_LONG_TERM_BLOCK_WEIGHT_WINDOW ? CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V5 : bc->get_current_cumulative_block_weight_limit();
uint64_t ltw = bc->get_next_long_term_block_weight(w);
- bc->get_db().add_block(cryptonote::block(), w, ltw, h, h, {});
+ bc->get_db().add_block(std::make_pair(cryptonote::block(), ""), w, ltw, h, h, {});
ASSERT_TRUE(bc->update_next_cumulative_weight_limit());
}
@@ -183,7 +183,7 @@ TEST(long_term_block_weight, multi_pop)
{
size_t w = h < TEST_LONG_TERM_BLOCK_WEIGHT_WINDOW ? CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V5 : bc->get_current_cumulative_block_weight_limit();
uint64_t ltw = bc->get_next_long_term_block_weight(w);
- bc->get_db().add_block(cryptonote::block(), w, ltw, h, h, {});
+ bc->get_db().add_block(std::make_pair(cryptonote::block(), ""), w, ltw, h, h, {});
ASSERT_TRUE(bc->update_next_cumulative_weight_limit());
}
@@ -207,7 +207,7 @@ TEST(long_term_block_weight, multiple_updates)
{
size_t w = h < TEST_LONG_TERM_BLOCK_WEIGHT_WINDOW ? CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V5 : bc->get_current_cumulative_block_weight_limit();
uint64_t ltw = bc->get_next_long_term_block_weight(w);
- bc->get_db().add_block(cryptonote::block(), w, ltw, h, h, {});
+ bc->get_db().add_block(std::make_pair(cryptonote::block(), ""), w, ltw, h, h, {});
ASSERT_TRUE(bc->update_next_cumulative_weight_limit());
const uint64_t effective_median = bc->get_current_cumulative_block_weight_median();
const uint64_t effective_limit = bc->get_current_cumulative_block_weight_limit();
@@ -231,7 +231,7 @@ TEST(long_term_block_weight, pop_invariant_max)
{
size_t w = bc->get_db().height() < TEST_LONG_TERM_BLOCK_WEIGHT_WINDOW ? CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V5 : bc->get_current_cumulative_block_weight_limit();
uint64_t ltw = bc->get_next_long_term_block_weight(w);
- bc->get_db().add_block(cryptonote::block(), w, ltw, h, h, {});
+ bc->get_db().add_block(std::make_pair(cryptonote::block(), ""), w, ltw, h, h, {});
ASSERT_TRUE(bc->update_next_cumulative_weight_limit());
}
@@ -259,7 +259,7 @@ TEST(long_term_block_weight, pop_invariant_max)
{
size_t w = bc->get_db().height() < TEST_LONG_TERM_BLOCK_WEIGHT_WINDOW ? CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V5 : bc->get_current_cumulative_block_weight_limit();
uint64_t ltw = bc->get_next_long_term_block_weight(w);
- bc->get_db().add_block(cryptonote::block(), w, ltw, bc->get_db().height(), bc->get_db().height(), {});
+ bc->get_db().add_block(std::make_pair(cryptonote::block(), ""), w, ltw, bc->get_db().height(), bc->get_db().height(), {});
ASSERT_TRUE(bc->update_next_cumulative_weight_limit());
}
@@ -279,7 +279,7 @@ TEST(long_term_block_weight, pop_invariant_random)
{
size_t w = bc->get_db().height() < TEST_LONG_TERM_BLOCK_WEIGHT_WINDOW ? CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V5 : bc->get_current_cumulative_block_weight_limit();
uint64_t ltw = bc->get_next_long_term_block_weight(w);
- bc->get_db().add_block(cryptonote::block(), w, ltw, h, h, {});
+ bc->get_db().add_block(std::make_pair(cryptonote::block(), ""), w, ltw, h, h, {});
ASSERT_TRUE(bc->update_next_cumulative_weight_limit());
}
@@ -314,7 +314,7 @@ TEST(long_term_block_weight, pop_invariant_random)
uint32_t r = lcg();
size_t w = bc->get_db().height() < TEST_LONG_TERM_BLOCK_WEIGHT_WINDOW ? CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V5 : (r % bc->get_current_cumulative_block_weight_limit());
uint64_t ltw = bc->get_next_long_term_block_weight(w);
- bc->get_db().add_block(cryptonote::block(), w, ltw, bc->get_db().height(), bc->get_db().height(), {});
+ bc->get_db().add_block(std::make_pair(cryptonote::block(), ""), w, ltw, bc->get_db().height(), bc->get_db().height(), {});
ASSERT_TRUE(bc->update_next_cumulative_weight_limit());
const uint64_t effective_median = bc->get_current_cumulative_block_weight_median();
const uint64_t effective_limit = bc->get_current_cumulative_block_weight_limit();
@@ -342,7 +342,7 @@ TEST(long_term_block_weight, long_growth_spike_and_drop)
{
size_t w = CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V5;
uint64_t ltw = bc->get_next_long_term_block_weight(w);
- bc->get_db().add_block(cryptonote::block(), w, ltw, h, h, {});
+ bc->get_db().add_block(std::make_pair(cryptonote::block(), ""), w, ltw, h, h, {});
ASSERT_TRUE(bc->update_next_cumulative_weight_limit(&long_term_effective_median_block_weight));
}
ASSERT_EQ(long_term_effective_median_block_weight, 300000);
@@ -354,7 +354,7 @@ TEST(long_term_block_weight, long_growth_spike_and_drop)
float t = h / float(365 * 720 * TEST_LONG_TERM_BLOCK_WEIGHT_WINDOW / 100000);
size_t w = 300000 + t * 30000;
uint64_t ltw = bc->get_next_long_term_block_weight(w);
- bc->get_db().add_block(cryptonote::block(), w, ltw, h, h, {});
+ bc->get_db().add_block(std::make_pair(cryptonote::block(), ""), w, ltw, h, h, {});
ASSERT_TRUE(bc->update_next_cumulative_weight_limit(&long_term_effective_median_block_weight));
}
ASSERT_GT(long_term_effective_median_block_weight, 300000 * 1.07);
@@ -365,7 +365,7 @@ TEST(long_term_block_weight, long_growth_spike_and_drop)
{
size_t w = bc->get_current_cumulative_block_weight_limit();
uint64_t ltw = bc->get_next_long_term_block_weight(w);
- bc->get_db().add_block(cryptonote::block(), w, ltw, h, h, {});
+ bc->get_db().add_block(std::make_pair(cryptonote::block(), ""), w, ltw, h, h, {});
ASSERT_TRUE(bc->update_next_cumulative_weight_limit(&long_term_effective_median_block_weight));
}
ASSERT_GT(long_term_effective_median_block_weight, 300000 * 1.07);
@@ -376,7 +376,7 @@ TEST(long_term_block_weight, long_growth_spike_and_drop)
{
size_t w = bc->get_current_cumulative_block_weight_median() * .25;
uint64_t ltw = bc->get_next_long_term_block_weight(w);
- bc->get_db().add_block(cryptonote::block(), w, ltw, h, h, {});
+ bc->get_db().add_block(std::make_pair(cryptonote::block(), ""), w, ltw, h, h, {});
ASSERT_TRUE(bc->update_next_cumulative_weight_limit(&long_term_effective_median_block_weight));
}
ASSERT_GT(long_term_effective_median_block_weight, 300000 * 1.07);