aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2019-09-14 13:04:41 -0500
committerluigi1111 <luigi1111w@gmail.com>2019-09-14 13:04:41 -0500
commit29e0f1130589e03b2dbc941c4333267798571804 (patch)
tree5d2196bc67031f04b9be43a04b3d0f203e861eb9 /tests
parentMerge pull request #5876 (diff)
parentblockchain: reject rct signatures in coinbase txes from v12 (diff)
downloadmonero-29e0f1130589e03b2dbc941c4333267798571804.tar.xz
Merge pull request #5823
26072f1 blockchain: forbid v1 coinbase from v12 (moneromooo-monero) 555dc7c core: from v12, require consistent ring size for mixable txes (moneromooo-monero) d22dfb7 blockchain: reject rct signatures in coinbase txes from v12 (moneromooo-monero)
Diffstat (limited to 'tests')
-rw-r--r--tests/core_tests/block_validation.cpp15
-rw-r--r--tests/core_tests/block_validation.h12
-rw-r--r--tests/core_tests/chaingen_main.cpp1
3 files changed, 28 insertions, 0 deletions
diff --git a/tests/core_tests/block_validation.cpp b/tests/core_tests/block_validation.cpp
index 566ec1440..55312bc15 100644
--- a/tests/core_tests/block_validation.cpp
+++ b/tests/core_tests/block_validation.cpp
@@ -640,3 +640,18 @@ bool gen_block_invalid_binary_format::check_all_blocks_purged(cryptonote::core&
return true;
}
+
+bool gen_block_late_v1_coinbase_tx::generate(std::vector<test_event_entry>& events) const
+{
+ BLOCK_VALIDATION_INIT_GENERATE();
+
+ block blk_1;
+ generator.construct_block_manually(blk_1, blk_0, miner_account,
+ test_generator::bf_major_ver | test_generator::bf_minor_ver,
+ HF_VERSION_MIN_V2_COINBASE_TX, HF_VERSION_MIN_V2_COINBASE_TX);
+ 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 4a65b029e..2393e1b01 100644
--- a/tests/core_tests/block_validation.h
+++ b/tests/core_tests/block_validation.h
@@ -206,3 +206,15 @@ struct gen_block_invalid_binary_format : public test_chain_unit_base
private:
size_t m_corrupt_blocks_begin_idx;
};
+
+struct gen_block_late_v1_coinbase_tx : public gen_block_verification_base<1>
+{
+ bool generate(std::vector<test_event_entry>& events) const;
+};
+template<>
+struct get_test_options<gen_block_late_v1_coinbase_tx> {
+ const std::pair<uint8_t, uint64_t> hard_forks[3] = {std::make_pair(1, 0), std::make_pair(HF_VERSION_MIN_V2_COINBASE_TX, 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 cb35cfde2..4ee71466e 100644
--- a/tests/core_tests/chaingen_main.cpp
+++ b/tests/core_tests/chaingen_main.cpp
@@ -133,6 +133,7 @@ int main(int argc, char* argv[])
GENERATE_AND_PLAY(gen_block_has_invalid_tx);
GENERATE_AND_PLAY(gen_block_is_too_big);
GENERATE_AND_PLAY(gen_block_invalid_binary_format); // Takes up to 3 hours, if CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW == 500, up to 30 minutes, if CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW == 10
+ GENERATE_AND_PLAY(gen_block_late_v1_coinbase_tx);
// Transaction verification tests
GENERATE_AND_PLAY(gen_tx_big_version);