aboutsummaryrefslogtreecommitdiff
path: root/tests/core_tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests/core_tests')
-rw-r--r--tests/core_tests/bulletproofs.cpp13
-rw-r--r--tests/core_tests/bulletproofs.h6
-rw-r--r--tests/core_tests/chaingen_main.cpp1
3 files changed, 20 insertions, 0 deletions
diff --git a/tests/core_tests/bulletproofs.cpp b/tests/core_tests/bulletproofs.cpp
index 3b3039a18..aea502faa 100644
--- a/tests/core_tests/bulletproofs.cpp
+++ b/tests/core_tests/bulletproofs.cpp
@@ -297,6 +297,19 @@ bool gen_bp_tx_invalid_not_enough_proofs::generate(std::vector<test_event_entry>
});
}
+bool gen_bp_tx_invalid_empty_proofs::generate(std::vector<test_event_entry>& events) const
+{
+ DEFINE_TESTS_ERROR_CONTEXT("gen_bp_tx_invalid_empty_proofs");
+ const size_t mixin = 10;
+ const uint64_t amounts_paid[] = {50000, 50000, (uint64_t)-1};
+ const rct::RangeProofType range_proof_type[] = { rct::RangeProofBulletproof };
+ return generate_with(events, mixin, 1, amounts_paid, false, range_proof_type, NULL, [&](cryptonote::transaction &tx, size_t idx){
+ CHECK_TEST_CONDITION(tx.rct_signatures.type == rct::RCTTypeBulletproof);
+ tx.rct_signatures.p.bulletproofs.clear();
+ return true;
+ });
+}
+
bool gen_bp_tx_invalid_too_many_proofs::generate(std::vector<test_event_entry>& events) const
{
DEFINE_TESTS_ERROR_CONTEXT("gen_bp_tx_invalid_too_many_proofs");
diff --git a/tests/core_tests/bulletproofs.h b/tests/core_tests/bulletproofs.h
index 13faa3493..c3a7db2c7 100644
--- a/tests/core_tests/bulletproofs.h
+++ b/tests/core_tests/bulletproofs.h
@@ -162,6 +162,12 @@ struct gen_bp_tx_invalid_not_enough_proofs : public gen_bp_tx_validation_base
};
template<> struct get_test_options<gen_bp_tx_invalid_not_enough_proofs>: public get_test_options<gen_bp_tx_validation_base> {};
+struct gen_bp_tx_invalid_empty_proofs : public gen_bp_tx_validation_base
+{
+ bool generate(std::vector<test_event_entry>& events) const;
+};
+template<> struct get_test_options<gen_bp_tx_invalid_empty_proofs>: public get_test_options<gen_bp_tx_validation_base> {};
+
struct gen_bp_tx_invalid_too_many_proofs : public gen_bp_tx_validation_base
{
bool generate(std::vector<test_event_entry>& events) const;
diff --git a/tests/core_tests/chaingen_main.cpp b/tests/core_tests/chaingen_main.cpp
index 278ef81a6..6f26e6532 100644
--- a/tests/core_tests/chaingen_main.cpp
+++ b/tests/core_tests/chaingen_main.cpp
@@ -234,6 +234,7 @@ int main(int argc, char* argv[])
GENERATE_AND_PLAY(gen_bp_txs_valid_2_and_2);
GENERATE_AND_PLAY(gen_bp_txs_invalid_2_and_8_2_and_16_16_1);
GENERATE_AND_PLAY(gen_bp_tx_invalid_not_enough_proofs);
+ GENERATE_AND_PLAY(gen_bp_tx_invalid_empty_proofs);
GENERATE_AND_PLAY(gen_bp_tx_invalid_too_many_proofs);
GENERATE_AND_PLAY(gen_bp_tx_invalid_wrong_amount);
GENERATE_AND_PLAY(gen_bp_tx_invalid_borromean_type);