diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/core_tests/tx_validation.cpp | 12 | ||||
-rw-r--r-- | tests/crypto/CMakeLists.txt | 10 | ||||
-rw-r--r-- | tests/daemon_tests/CMakeLists.txt | 2 | ||||
-rw-r--r-- | tests/functional_tests/CMakeLists.txt | 2 | ||||
-rw-r--r-- | tests/hash/CMakeLists.txt | 2 | ||||
-rw-r--r-- | tests/performance_tests/CMakeLists.txt | 2 | ||||
-rw-r--r-- | tests/unit_tests/hardfork.cpp | 2 |
7 files changed, 20 insertions, 12 deletions
diff --git a/tests/core_tests/tx_validation.cpp b/tests/core_tests/tx_validation.cpp index 885b95c69..66460e876 100644 --- a/tests/core_tests/tx_validation.cpp +++ b/tests/core_tests/tx_validation.cpp @@ -163,6 +163,15 @@ namespace throw std::runtime_error("invalid public key wasn't found"); return crypto::public_key(); } + + crypto::key_image generate_invalid_key_image() + { + crypto::key_image key_image; + // a random key image plucked from the blockchain + if (!epee::string_tools::hex_to_pod("6b9f5d1be7c950dc6e4e258c6ef75509412ba9ecaaf90e6886140151d1365b5e", key_image)) + throw std::runtime_error("invalid key image wasn't found"); + return key_image; + } } //---------------------------------------------------------------------------------------------------------------------- @@ -541,8 +550,7 @@ bool gen_tx_key_image_is_invalid::generate(std::vector<test_event_entry>& events builder.step2_fill_inputs(miner_account.get_keys(), sources); txin_to_key& in_to_key = boost::get<txin_to_key>(builder.m_tx.vin.front()); - crypto::public_key pub = generate_invalid_pub_key(); - memcpy(&in_to_key.k_image, &pub, sizeof(crypto::ec_point)); + in_to_key.k_image = generate_invalid_key_image(); builder.step3_fill_outputs(destinations); builder.step4_calc_hash(); diff --git a/tests/crypto/CMakeLists.txt b/tests/crypto/CMakeLists.txt index e1c632a00..573c62ad4 100644 --- a/tests/crypto/CMakeLists.txt +++ b/tests/crypto/CMakeLists.txt @@ -37,17 +37,17 @@ set(crypto_sources set(crypto_headers crypto-tests.h) -add_executable(crypto-tests +add_executable(cncrypto-tests ${crypto_sources} ${crypto_headers}) -target_link_libraries(crypto-tests +target_link_libraries(cncrypto-tests PRIVATE ${Boost_SYSTEM_LIBRARY} ${EXTRA_LIBRARIES}) -set_property(TARGET crypto-tests +set_property(TARGET cncrypto-tests PROPERTY FOLDER "tests") add_test( - NAME crypto - COMMAND crypto-tests "${CMAKE_CURRENT_SOURCE_DIR}/tests.txt") + NAME cncrypto + COMMAND cncrypto-tests "${CMAKE_CURRENT_SOURCE_DIR}/tests.txt") diff --git a/tests/daemon_tests/CMakeLists.txt b/tests/daemon_tests/CMakeLists.txt index c6dc69e9d..b554bfec8 100644 --- a/tests/daemon_tests/CMakeLists.txt +++ b/tests/daemon_tests/CMakeLists.txt @@ -39,7 +39,7 @@ target_link_libraries(transfers useragent rpc cryptonote_core - crypto + cncrypto common epee ${GTEST_LIBRARIES}) diff --git a/tests/functional_tests/CMakeLists.txt b/tests/functional_tests/CMakeLists.txt index 166476904..498fe3c2c 100644 --- a/tests/functional_tests/CMakeLists.txt +++ b/tests/functional_tests/CMakeLists.txt @@ -43,7 +43,7 @@ target_link_libraries(functional_tests cryptonote_core wallet common - crypto + cncrypto epee ${Boost_REGEX_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY} diff --git a/tests/hash/CMakeLists.txt b/tests/hash/CMakeLists.txt index 0f579cc6a..5cc95efbb 100644 --- a/tests/hash/CMakeLists.txt +++ b/tests/hash/CMakeLists.txt @@ -36,7 +36,7 @@ add_executable(hash-tests ${hash_headers}) target_link_libraries(hash-tests PRIVATE - crypto + cncrypto ${EXTRA_LIBRARIES}) set_property(TARGET hash-tests PROPERTY diff --git a/tests/performance_tests/CMakeLists.txt b/tests/performance_tests/CMakeLists.txt index 7845515de..2b3a0d6f8 100644 --- a/tests/performance_tests/CMakeLists.txt +++ b/tests/performance_tests/CMakeLists.txt @@ -53,7 +53,7 @@ target_link_libraries(performance_tests PRIVATE cryptonote_core common - crypto + cncrypto epee ${Boost_CHRONO_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} diff --git a/tests/unit_tests/hardfork.cpp b/tests/unit_tests/hardfork.cpp index e29919e8f..4bfe90733 100644 --- a/tests/unit_tests/hardfork.cpp +++ b/tests/unit_tests/hardfork.cpp @@ -106,7 +106,7 @@ public: virtual void remove_spent_key(const crypto::key_image& k_image) {} virtual bool for_all_key_images(std::function<bool(const crypto::key_image&)>) const { return true; } - virtual bool for_all_blocks(std::function<bool(uint64_t, const crypto::hash&, const cryptonote::block&)>) const { return true; } + virtual bool for_blocks_range(const uint64_t&, const uint64_t&, std::function<bool(uint64_t, const crypto::hash&, const cryptonote::block&)>) const { return true; } virtual bool for_all_transactions(std::function<bool(const crypto::hash&, const cryptonote::transaction&)>) const { return true; } virtual bool for_all_outputs(std::function<bool(uint64_t amount, const crypto::hash &tx_hash, size_t tx_idx)> f) const { return true; } virtual bool is_read_only() const { return false; } |