diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2017-09-10 12:39:21 +0100 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2017-09-25 15:48:51 +0100 |
commit | 50a629b2e6071466c0807084c470b733ef96ca0a (patch) | |
tree | f0a55ca8f75f6b4f8bfa622b0357244fe822d6f2 /tests | |
parent | wallet2: catch failure to parse address (diff) | |
download | monero-50a629b2e6071466c0807084c470b733ef96ca0a.tar.xz |
core_tests: catch (impossible in practice) tx extra api failure
CID 175301
Diffstat (limited to 'tests')
-rw-r--r-- | tests/core_tests/rct.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/core_tests/rct.cpp b/tests/core_tests/rct.cpp index 21638354d..1bdd48fa1 100644 --- a/tests/core_tests/rct.cpp +++ b/tests/core_tests/rct.cpp @@ -484,8 +484,9 @@ bool gen_rct_tx_pre_rct_altered_extra::generate(std::vector<test_event_entry>& e const int mixin = 2; const int out_idx[] = {0, -1}; const uint64_t amount_paid = 10000; + bool failed = false; return generate_with(events, out_idx, mixin, amount_paid, false, - NULL, [](transaction &tx) {std::string extra_nonce; crypto::hash pid = cryptonote::null_hash; set_payment_id_to_tx_extra_nonce(extra_nonce, pid); add_extra_nonce_to_tx_extra(tx.extra, extra_nonce);}); + NULL, [&failed](transaction &tx) {std::string extra_nonce; crypto::hash pid = cryptonote::null_hash; set_payment_id_to_tx_extra_nonce(extra_nonce, pid); if (!add_extra_nonce_to_tx_extra(tx.extra, extra_nonce)) failed = true; }) && !failed; } bool gen_rct_tx_rct_altered_extra::generate(std::vector<test_event_entry>& events) const @@ -493,7 +494,8 @@ bool gen_rct_tx_rct_altered_extra::generate(std::vector<test_event_entry>& event const int mixin = 2; const int out_idx[] = {1, -1}; const uint64_t amount_paid = 10000; + bool failed = false; return generate_with(events, out_idx, mixin, amount_paid, false, - NULL, [](transaction &tx) {std::string extra_nonce; crypto::hash pid = cryptonote::null_hash; set_payment_id_to_tx_extra_nonce(extra_nonce, pid); add_extra_nonce_to_tx_extra(tx.extra, extra_nonce);}); + NULL, [&failed](transaction &tx) {std::string extra_nonce; crypto::hash pid = cryptonote::null_hash; set_payment_id_to_tx_extra_nonce(extra_nonce, pid); if (!add_extra_nonce_to_tx_extra(tx.extra, extra_nonce)) failed = true; }) && !failed; } |