performance_tests: add tx checking tests with more than 2 outputs

This commit is contained in:
moneromooo-monero 2018-01-14 23:05:48 +00:00
parent 0793184bd0
commit f34e2e20bd
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3
2 changed files with 22 additions and 11 deletions

View file

@ -40,15 +40,17 @@
#include "multi_tx_test_base.h"
template<size_t a_ring_size, bool a_rct>
template<size_t a_ring_size, size_t a_outputs, bool a_rct, bool a_bulletproof>
class test_check_tx_signature : private multi_tx_test_base<a_ring_size>
{
static_assert(0 < a_ring_size, "ring_size must be greater than 0");
public:
static const size_t loop_count = a_rct ? 10 : a_ring_size < 100 ? 100 : 10;
static const size_t loop_count = a_rct ? (a_ring_size <= 2 ? 50 : 10) : a_ring_size < 100 ? 100 : 10;
static const size_t ring_size = a_ring_size;
static const size_t outputs = a_outputs;
static const bool rct = a_rct;
static const bool bulletproof = a_bulletproof;
typedef multi_tx_test_base<a_ring_size> base_class;
@ -62,13 +64,15 @@ public:
m_alice.generate();
std::vector<tx_destination_entry> destinations;
destinations.push_back(tx_destination_entry(this->m_source_amount, m_alice.get_keys().m_account_address, false));
destinations.push_back(tx_destination_entry(this->m_source_amount - outputs + 1, m_alice.get_keys().m_account_address, false));
for (size_t n = 1; n < outputs; ++n)
destinations.push_back(tx_destination_entry(1, m_alice.get_keys().m_account_address, false));
crypto::secret_key tx_key;
std::vector<crypto::secret_key> additional_tx_keys;
std::unordered_map<crypto::public_key, cryptonote::subaddress_index> subaddresses;
subaddresses[this->m_miners[this->real_source_idx].get_keys().m_account_address.m_spend_public_key] = {0,0};
if (!construct_tx_and_get_tx_key(this->m_miners[this->real_source_idx].get_keys(), subaddresses, this->m_sources, destinations, cryptonote::account_public_address{}, std::vector<uint8_t>(), m_tx, 0, tx_key, additional_tx_keys, rct))
if (!construct_tx_and_get_tx_key(this->m_miners[this->real_source_idx].get_keys(), subaddresses, this->m_sources, destinations, cryptonote::account_public_address{}, std::vector<uint8_t>(), m_tx, 0, tx_key, additional_tx_keys, rct, bulletproof))
return false;
get_transaction_prefix_hash(m_tx, m_tx_prefix_hash);

View file

@ -124,14 +124,21 @@ int main(int argc, char** argv)
TEST_PERFORMANCE3(filter, verbose, test_construct_tx, 100, 2, true);
TEST_PERFORMANCE3(filter, verbose, test_construct_tx, 100, 10, true);
TEST_PERFORMANCE2(filter, verbose, test_check_tx_signature, 1, false);
TEST_PERFORMANCE2(filter, verbose, test_check_tx_signature, 2, false);
TEST_PERFORMANCE2(filter, verbose, test_check_tx_signature, 10, false);
TEST_PERFORMANCE2(filter, verbose, test_check_tx_signature, 100, false);
TEST_PERFORMANCE4(filter, verbose, test_check_tx_signature, 1, 2, false, false);
TEST_PERFORMANCE4(filter, verbose, test_check_tx_signature, 2, 2, false, false);
TEST_PERFORMANCE4(filter, verbose, test_check_tx_signature, 10, 2, false, false);
TEST_PERFORMANCE4(filter, verbose, test_check_tx_signature, 100, 2, false, false);
TEST_PERFORMANCE4(filter, verbose, test_check_tx_signature, 2, 10, false, false);
TEST_PERFORMANCE2(filter, verbose, test_check_tx_signature, 2, true);
TEST_PERFORMANCE2(filter, verbose, test_check_tx_signature, 10, true);
TEST_PERFORMANCE2(filter, verbose, test_check_tx_signature, 100, true);
TEST_PERFORMANCE4(filter, verbose, test_check_tx_signature, 2, 2, true, false);
TEST_PERFORMANCE4(filter, verbose, test_check_tx_signature, 10, 2, true, false);
TEST_PERFORMANCE4(filter, verbose, test_check_tx_signature, 100, 2, true, false);
TEST_PERFORMANCE4(filter, verbose, test_check_tx_signature, 2, 10, true, false);
TEST_PERFORMANCE4(filter, verbose, test_check_tx_signature, 2, 2, true, true);
TEST_PERFORMANCE4(filter, verbose, test_check_tx_signature, 10, 2, true, true);
TEST_PERFORMANCE4(filter, verbose, test_check_tx_signature, 100, 2, true, true);
TEST_PERFORMANCE4(filter, verbose, test_check_tx_signature, 2, 10, true, true);
TEST_PERFORMANCE0(filter, verbose, test_is_out_to_acc);
TEST_PERFORMANCE0(filter, verbose, test_is_out_to_acc_precomp);