diff --git a/tests/core_tests/chaingen.cpp b/tests/core_tests/chaingen.cpp index b15bdacc..01aa5f8b 100644 --- a/tests/core_tests/chaingen.cpp +++ b/tests/core_tests/chaingen.cpp @@ -2053,6 +2053,25 @@ bool check_ring_signature_at_gen_time(const std::vector& event return true; } +bool check_mixin_value_for_each_input(size_t mixin, const crypto::hash& tx_id, currency::core& c) +{ + std::shared_ptr ptce = c.get_blockchain_storage().get_tx_chain_entry(tx_id); + if (!ptce) + return false; + + for (size_t i = 0; i < ptce->tx.vin.size(); ++i) + { + auto& input = ptce->tx.vin[i]; + if (input.type() == typeid(txin_to_key)) + { + auto& intk = boost::get(input); + CHECK_AND_ASSERT_MES(intk.key_offsets.size() == mixin + 1, false, "for input #" << i << " mixin count is " << intk.key_offsets.size() - 1 << ", expected is " << mixin); + } + } + + return true; +} + //------------------------------------------------------------------------------ void test_chain_unit_base::register_callback(const std::string& cb_name, verify_callback cb) diff --git a/tests/core_tests/chaingen.h b/tests/core_tests/chaingen.h index 6b9b4c04..7cbf4822 100644 --- a/tests/core_tests/chaingen.h +++ b/tests/core_tests/chaingen.h @@ -679,6 +679,7 @@ bool generate_pos_block_with_given_coinstake(test_generator& generator, const st bool check_ring_signature_at_gen_time(const std::vector& events, const crypto::hash& last_block_id, const currency::txin_to_key& in_t_k, const crypto::hash& hash_for_sig, const std::vector &sig); +bool check_mixin_value_for_each_input(size_t mixin, const crypto::hash& tx_id, currency::core& c); //-------------------------------------------------------------------------- template