aboutsummaryrefslogtreecommitdiff
path: root/tests/core_tests
diff options
context:
space:
mode:
authorAlexander Blair <snipa@jagtech.io>2020-08-27 03:01:28 -0700
committerAlexander Blair <snipa@jagtech.io>2020-08-27 03:01:28 -0700
commitb04da25e4d63e53aaaa260e6aaebf19fb7d7a3dd (patch)
tree039b0c0a21de62e48f68ec2a71fee3ffd34cbf3e /tests/core_tests
parentMerge pull request #6746 (diff)
parentenforce claiming maximum coinbase amount (diff)
downloadmonero-b04da25e4d63e53aaaa260e6aaebf19fb7d7a3dd.tar.xz
Merge pull request #6760
844fb4e94 enforce claiming maximum coinbase amount (moneromooo-monero)
Diffstat (limited to 'tests/core_tests')
-rw-r--r--tests/core_tests/block_validation.cpp16
-rw-r--r--tests/core_tests/block_validation.h12
-rw-r--r--tests/core_tests/chaingen_main.cpp2
3 files changed, 30 insertions, 0 deletions
diff --git a/tests/core_tests/block_validation.cpp b/tests/core_tests/block_validation.cpp
index 10b1b9af4..fb8ddbe11 100644
--- a/tests/core_tests/block_validation.cpp
+++ b/tests/core_tests/block_validation.cpp
@@ -655,3 +655,19 @@ bool gen_block_late_v1_coinbase_tx::generate(std::vector<test_event_entry>& even
return true;
}
+
+bool gen_block_low_coinbase::generate(std::vector<test_event_entry>& events) const
+{
+ BLOCK_VALIDATION_INIT_GENERATE();
+
+ block blk_1;
+ std::vector<size_t> block_weights;
+ generator.construct_block(blk_1, cryptonote::get_block_height(blk_0) + 1, cryptonote::get_block_hash(blk_0),
+ miner_account, blk_0.timestamp + DIFFICULTY_TARGET_V2, COIN + generator.get_already_generated_coins(cryptonote::get_block_hash(blk_0)),
+ block_weights, {}, HF_VERSION_EXACT_COINBASE);
+ events.push_back(blk_1);
+
+ DO_CALLBACK(events, "check_block_purged");
+
+ return true;
+}
diff --git a/tests/core_tests/block_validation.h b/tests/core_tests/block_validation.h
index 39eba0829..0dd4e145c 100644
--- a/tests/core_tests/block_validation.h
+++ b/tests/core_tests/block_validation.h
@@ -218,3 +218,15 @@ struct get_test_options<gen_block_late_v1_coinbase_tx> {
hard_forks, 0
};
};
+
+struct gen_block_low_coinbase : public gen_block_verification_base<1>
+{
+ bool generate(std::vector<test_event_entry>& events) const;
+};
+template<>
+struct get_test_options<gen_block_low_coinbase> {
+ const std::pair<uint8_t, uint64_t> hard_forks[3] = {std::make_pair(1, 0), std::make_pair(HF_VERSION_EXACT_COINBASE, 1), std::make_pair(0, 0)};
+ const cryptonote::test_options test_options = {
+ hard_forks, 0
+ };
+};
diff --git a/tests/core_tests/chaingen_main.cpp b/tests/core_tests/chaingen_main.cpp
index 38382b95f..9895d4814 100644
--- a/tests/core_tests/chaingen_main.cpp
+++ b/tests/core_tests/chaingen_main.cpp
@@ -264,6 +264,8 @@ int main(int argc, char* argv[])
GENERATE_AND_PLAY(gen_bp_tx_invalid_wrong_amount);
GENERATE_AND_PLAY(gen_bp_tx_invalid_borromean_type);
+ GENERATE_AND_PLAY(gen_block_low_coinbase);
+
el::Level level = (failed_tests.empty() ? el::Level::Info : el::Level::Error);
if (!list_tests)
{