Electroneum
test_check_tx_signature< a_ring_size, a_outputs, a_rct, range_proof_type, bp_version > Class Template Reference

#include <check_tx_signature.h>

Inheritance diagram for test_check_tx_signature< a_ring_size, a_outputs, a_rct, range_proof_type, bp_version >:
Collaboration diagram for test_check_tx_signature< a_ring_size, a_outputs, a_rct, range_proof_type, bp_version >:

Public Types

typedef multi_tx_test_base< a_ring_size > base_class
 

Public Member Functions

bool init ()
 
bool test ()
 

Static Public Attributes

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
 

Detailed Description

template<size_t a_ring_size, size_t a_outputs, bool a_rct, rct::RangeProofType range_proof_type = rct::RangeProofBorromean, int bp_version = 2>
class test_check_tx_signature< a_ring_size, a_outputs, a_rct, range_proof_type, bp_version >

Definition at line 45 of file check_tx_signature.h.

Member Typedef Documentation

◆ base_class

template<size_t a_ring_size, size_t a_outputs, bool a_rct, rct::RangeProofType range_proof_type = rct::RangeProofBorromean, int bp_version = 2>
typedef multi_tx_test_base<a_ring_size> test_check_tx_signature< a_ring_size, a_outputs, a_rct, range_proof_type, bp_version >::base_class

Definition at line 55 of file check_tx_signature.h.

Member Function Documentation

◆ init()

template<size_t a_ring_size, size_t a_outputs, bool a_rct, rct::RangeProofType range_proof_type = rct::RangeProofBorromean, int bp_version = 2>
bool test_check_tx_signature< a_ring_size, a_outputs, a_rct, range_proof_type, bp_version >::init ( )
inline

Definition at line 57 of file check_tx_signature.h.

58  {
59  using namespace cryptonote;
60 
61  if (!base_class::init())
62  return false;
63 
64  m_alice.generate();
65 
66  std::vector<tx_destination_entry> destinations;
67  destinations.push_back(tx_destination_entry(this->m_source_amount - outputs + 1, m_alice.get_keys().m_account_address, false));
68  for (size_t n = 1; n < outputs; ++n)
69  destinations.push_back(tx_destination_entry(1, m_alice.get_keys().m_account_address, false));
70 
71  crypto::secret_key tx_key;
72  std::vector<crypto::secret_key> additional_tx_keys;
73  std::unordered_map<crypto::public_key, cryptonote::subaddress_index> subaddresses;
74  subaddresses[this->m_miners[this->real_source_idx].get_keys().m_account_address.m_spend_public_key] = {0,0};
75  rct::RCTConfig rct_config{range_proof_type, bp_version};
76  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, rct_config))
77  return false;
78 
79  get_transaction_prefix_hash(m_tx, m_tx_prefix_hash);
80 
81  return true;
82  }
cryptonote::account_base m_miners[ring_size]
static const size_t real_source_idx
const account_keys & get_keys() const
Definition: account.cpp:264
Holds cryptonote related classes and helpers.
Definition: ban.cpp:40
account_public_address m_account_address
Definition: account.h:43
void get_transaction_prefix_hash(const transaction_prefix &tx, crypto::hash &h)
static const size_t outputs
std::vector< cryptonote::tx_source_entry > m_sources
bool construct_tx_and_get_tx_key(const account_keys &sender_account_keys, const std::unordered_map< crypto::public_key, subaddress_index > &subaddresses, std::vector< tx_source_entry > &sources, std::vector< tx_destination_entry > &destinations, const boost::optional< cryptonote::account_public_address > &change_addr, const std::vector< uint8_t > &extra, transaction &tx, uint64_t unlock_time, crypto::secret_key &tx_key, std::vector< crypto::secret_key > &additional_tx_keys, bool rct, const rct::RCTConfig &rct_config, rct::multisig_out *msout, const uint32_t account_major_offset, const cryptonote::network_type nettype)
Here is the call graph for this function:

◆ test()

template<size_t a_ring_size, size_t a_outputs, bool a_rct, rct::RangeProofType range_proof_type = rct::RangeProofBorromean, int bp_version = 2>
bool test_check_tx_signature< a_ring_size, a_outputs, a_rct, range_proof_type, bp_version >::test ( )
inline

Definition at line 84 of file check_tx_signature.h.

85  {
86  if (rct)
87  {
89  return rct::verRct(m_tx.rct_signatures);
90  else
91  return rct::verRctSimple(m_tx.rct_signatures);
92  }
93  else
94  {
95  const cryptonote::txin_to_key& txin = boost::get<cryptonote::txin_to_key>(m_tx.vin[0]);
96  return crypto::check_ring_signature(m_tx_prefix_hash, txin.k_image, this->m_public_key_ptrs, ring_size, m_tx.signatures[0].data());
97  }
98  }
bool check_ring_signature(const hash &prefix_hash, const key_image &image, const public_key *const *pubs, std::size_t pubs_count, const signature *sig)
Definition: crypto.h:333
bool verRct(const rctSig &rv, bool semantics)
Definition: rctSigs.cpp:913
uint8_t type
Definition: rctTypes.h:241
static const size_t ring_size
std::vector< std::vector< crypto::signature > > signatures
crypto::key_image k_image
Here is the call graph for this function:

Member Data Documentation

◆ loop_count

template<size_t a_ring_size, size_t a_outputs, bool a_rct, rct::RangeProofType range_proof_type = rct::RangeProofBorromean, int bp_version = 2>
const size_t test_check_tx_signature< a_ring_size, a_outputs, a_rct, range_proof_type, bp_version >::loop_count = a_rct ? (a_ring_size <= 2 ? 50 : 10) : a_ring_size < 100 ? 100 : 10
static

Definition at line 50 of file check_tx_signature.h.

◆ outputs

template<size_t a_ring_size, size_t a_outputs, bool a_rct, rct::RangeProofType range_proof_type = rct::RangeProofBorromean, int bp_version = 2>
const size_t test_check_tx_signature< a_ring_size, a_outputs, a_rct, range_proof_type, bp_version >::outputs = a_outputs
static

Definition at line 52 of file check_tx_signature.h.

◆ rct

template<size_t a_ring_size, size_t a_outputs, bool a_rct, rct::RangeProofType range_proof_type = rct::RangeProofBorromean, int bp_version = 2>
const bool test_check_tx_signature< a_ring_size, a_outputs, a_rct, range_proof_type, bp_version >::rct = a_rct
static

Definition at line 53 of file check_tx_signature.h.

◆ ring_size

template<size_t a_ring_size, size_t a_outputs, bool a_rct, rct::RangeProofType range_proof_type = rct::RangeProofBorromean, int bp_version = 2>
const size_t test_check_tx_signature< a_ring_size, a_outputs, a_rct, range_proof_type, bp_version >::ring_size = a_ring_size
static

Definition at line 51 of file check_tx_signature.h.


The documentation for this class was generated from the following file: