Electroneum
cryptonote_format_utils.cpp File Reference
#include <atomic>
#include <boost/algorithm/string.hpp>
#include "wipeable_string.h"
#include "string_tools.h"
#include "serialization/string.h"
#include "cryptonote_format_utils.h"
#include "cryptonote_config.h"
#include "crypto/crypto.h"
#include "crypto/hash.h"
#include "ringct/rctSigs.h"
Include dependency graph for cryptonote_format_utils.cpp:

Go to the source code of this file.

Namespaces

 cryptonote
 Holds cryptonote related classes and helpers.
 

Macros

#define ELECTRONEUM_DEFAULT_LOG_CATEGORY   "cn"
 
#define ENCRYPTED_PAYMENT_ID_TAIL   0x8d
 
#define CHECK_AND_ASSERT_THROW_MES_L1(expr, message)   {if(!(expr)) {MWARNING(message); throw std::runtime_error(message);}}
 

Functions

void cryptonote::get_transaction_prefix_hash (const transaction_prefix &tx, crypto::hash &h)
 
crypto::hash cryptonote::get_transaction_prefix_hash (const transaction_prefix &tx)
 
bool cryptonote::expand_transaction_1 (transaction &tx, bool base_only)
 
bool cryptonote::parse_and_validate_tx_from_blob (const blobdata &tx_blob, transaction &tx)
 
bool cryptonote::parse_and_validate_tx_base_from_blob (const blobdata &tx_blob, transaction &tx)
 
bool cryptonote::parse_and_validate_tx_prefix_from_blob (const blobdata &tx_blob, transaction_prefix &tx)
 
bool cryptonote::parse_and_validate_tx_from_blob (const blobdata &tx_blob, transaction &tx, crypto::hash &tx_hash)
 
bool cryptonote::parse_and_validate_tx_from_blob (const blobdata &tx_blob, transaction &tx, crypto::hash &tx_hash, crypto::hash &tx_prefix_hash)
 
bool cryptonote::is_v1_tx (const blobdata_ref &tx_blob)
 
bool cryptonote::is_v1_tx (const blobdata &tx_blob)
 
bool cryptonote::generate_key_image_helper (const account_keys &ack, const std::unordered_map< crypto::public_key, subaddress_index > &subaddresses, const crypto::public_key &out_key, const crypto::public_key &tx_public_key, const std::vector< crypto::public_key > &additional_tx_public_keys, size_t real_output_index, keypair &in_ephemeral, crypto::key_image &ki, hw::device &hwdev, const uint32_t account_major_offset)
 
bool cryptonote::generate_key_image_helper_precomp (const account_keys &ack, const crypto::public_key &out_key, const crypto::key_derivation &recv_derivation, size_t real_output_index, const subaddress_index &received_index, keypair &in_ephemeral, crypto::key_image &ki, hw::device &hwdev, const uint32_t account_major_offset)
 
uint64_t cryptonote::power_integral (uint64_t a, uint64_t b)
 
bool cryptonote::parse_amount (uint64_t &amount, const std::string &str_amount_)
 
uint64_t cryptonote::get_transaction_weight (const transaction &tx, size_t blob_size)
 
uint64_t cryptonote::get_transaction_weight (const transaction &tx)
 
bool cryptonote::get_tx_fee (const transaction &tx, uint64_t &fee)
 
uint64_t cryptonote::get_tx_fee (const transaction &tx)
 
bool cryptonote::parse_tx_extra (const std::vector< uint8_t > &tx_extra, std::vector< tx_extra_field > &tx_extra_fields)
 
bool cryptonote::sort_tx_extra (const std::vector< uint8_t > &tx_extra, std::vector< uint8_t > &sorted_tx_extra, bool allow_partial)
 
crypto::public_key cryptonote::get_tx_pub_key_from_extra (const std::vector< uint8_t > &tx_extra, size_t pk_index)
 
crypto::public_key cryptonote::get_tx_pub_key_from_extra (const transaction_prefix &tx_prefix, size_t pk_index)
 
crypto::public_key cryptonote::get_tx_pub_key_from_extra (const transaction &tx, size_t pk_index)
 
bool cryptonote::add_tx_pub_key_to_extra (transaction &tx, const crypto::public_key &tx_pub_key)
 
bool cryptonote::add_tx_pub_key_to_extra (transaction_prefix &tx, const crypto::public_key &tx_pub_key)
 
bool cryptonote::add_tx_pub_key_to_extra (std::vector< uint8_t > &tx_extra, const crypto::public_key &tx_pub_key)
 
std::vector< crypto::public_keycryptonote::get_additional_tx_pub_keys_from_extra (const std::vector< uint8_t > &tx_extra)
 
std::vector< crypto::public_keycryptonote::get_additional_tx_pub_keys_from_extra (const transaction_prefix &tx)
 
bool cryptonote::add_additional_tx_pub_keys_to_extra (std::vector< uint8_t > &tx_extra, const std::vector< crypto::public_key > &additional_pub_keys)
 
bool cryptonote::add_extra_nonce_to_tx_extra (std::vector< uint8_t > &tx_extra, const blobdata &extra_nonce)
 
bool cryptonote::add_bridge_source_address_to_tx_extra (std::vector< uint8_t > &tx_extra, const blobdata &bridge_source_address)
 
bool cryptonote::add_bridge_smartchain_address_to_tx_extra (std::vector< uint8_t > &tx_extra, const blobdata &bridge_smartchain_address)
 
bool cryptonote::remove_field_from_tx_extra (std::vector< uint8_t > &tx_extra, const std::type_info &type)
 
void cryptonote::set_payment_id_to_tx_extra_nonce (blobdata &extra_nonce, const crypto::hash &payment_id)
 
void cryptonote::set_encrypted_payment_id_to_tx_extra_nonce (blobdata &extra_nonce, const crypto::hash8 &payment_id)
 
bool cryptonote::get_payment_id_from_tx_extra_nonce (const blobdata &extra_nonce, crypto::hash &payment_id)
 
bool cryptonote::get_encrypted_payment_id_from_tx_extra_nonce (const blobdata &extra_nonce, crypto::hash8 &payment_id)
 
bool cryptonote::get_inputs_etn_amount (const transaction &tx, uint64_t &etn)
 
uint64_t cryptonote::get_block_height (const block &b)
 
bool cryptonote::check_inputs_types_supported (const transaction &tx)
 
bool cryptonote::check_outs_valid (const transaction &tx)
 
bool cryptonote::check_etn_overflow (const transaction &tx)
 
bool cryptonote::check_inputs_overflow (const transaction &tx)
 
bool cryptonote::check_outs_overflow (const transaction &tx)
 
uint64_t cryptonote::get_outs_etn_amount (const transaction &tx)
 
std::string cryptonote::short_hash_str (const crypto::hash &h)
 
bool cryptonote::is_out_to_acc (const account_keys &acc, const txout_to_key &out_key, const crypto::public_key &tx_pub_key, const std::vector< crypto::public_key > &additional_tx_pub_keys, size_t output_index)
 
boost::optional< subaddress_receive_info > cryptonote::is_out_to_acc_precomp (const std::unordered_map< crypto::public_key, subaddress_index > &subaddresses, const crypto::public_key &out_key, const crypto::key_derivation &derivation, const std::vector< crypto::key_derivation > &additional_derivations, size_t output_index, hw::device &hwdev)
 
boost::optional< subaddress_receive_info > cryptonote::is_out_to_acc_precomp_public (const std::unordered_map< crypto::public_key, subaddress_index > &subaddresses, const cryptonote::account_public_address output_address)
 
bool cryptonote::lookup_acc_outs (const account_keys &acc, const transaction &tx, std::vector< size_t > &outs, uint64_t &etn_transfered)
 
bool cryptonote::lookup_acc_outs (const account_keys &acc, const transaction &tx, const crypto::public_key &tx_pub_key, const std::vector< crypto::public_key > &additional_tx_pub_keys, std::vector< size_t > &outs, uint64_t &etn_transfered)
 
void cryptonote::get_blob_hash (const epee::span< const char > &blob, crypto::hash &res)
 
void cryptonote::get_blob_hash (const blobdata &blob, crypto::hash &res)
 
void cryptonote::set_default_decimal_point (unsigned int decimal_point)
 
unsigned int cryptonote::get_default_decimal_point ()
 
std::string cryptonote::get_unit (unsigned int decimal_point)
 
std::string cryptonote::print_etn (uint64_t amount, unsigned int decimal_point)
 
crypto::hash cryptonote::get_blob_hash (const blobdata &blob)
 
crypto::hash cryptonote::get_blob_hash (const epee::span< const char > &blob)
 
crypto::hash cryptonote::get_transaction_hash (const transaction &t)
 
bool cryptonote::get_transaction_hash (const transaction &t, crypto::hash &res)
 
bool cryptonote::calculate_transaction_prunable_hash (const transaction &t, const cryptonote::blobdata *blob, crypto::hash &res)
 
crypto::hash cryptonote::get_transaction_prunable_hash (const transaction &t, const cryptonote::blobdata *blobdata)
 
crypto::hash cryptonote::get_pruned_transaction_hash (const transaction &t, const crypto::hash &pruned_data_hash)
 
bool cryptonote::calculate_transaction_hash (const transaction &t, crypto::hash &res, size_t *blob_size)
 
bool cryptonote::get_transaction_hash (const transaction &t, crypto::hash &res, size_t *blob_size)
 
bool cryptonote::get_transaction_hash (const transaction &t, crypto::hash &res, size_t &blob_size)
 
blobdata cryptonote::get_block_hashing_blob (const block &b)
 
bool cryptonote::calculate_block_hash (const block &b, crypto::hash &res, const blobdata *blob)
 
bool cryptonote::get_block_hash (const block &b, crypto::hash &res)
 
crypto::hash cryptonote::get_block_hash (const block &b)
 
bool cryptonote::get_block_longhash (const block &b, crypto::hash &res, uint64_t height)
 
std::vector< uint64_tcryptonote::relative_output_offsets_to_absolute (const std::vector< uint64_t > &off)
 
std::vector< uint64_tcryptonote::absolute_output_offsets_to_relative (const std::vector< uint64_t > &off)
 
crypto::hash cryptonote::get_block_longhash (const block &b, uint64_t height)
 
bool cryptonote::parse_and_validate_block_from_blob (const blobdata &b_blob, block &b, crypto::hash *block_hash)
 
bool cryptonote::parse_and_validate_block_from_blob (const blobdata &b_blob, block &b)
 
bool cryptonote::parse_and_validate_block_from_blob (const blobdata &b_blob, block &b, crypto::hash &block_hash)
 
blobdata cryptonote::block_to_blob (const block &b)
 
bool cryptonote::block_to_blob (const block &b, blobdata &b_blob)
 
blobdata cryptonote::tx_to_blob (const transaction &tx)
 
bool cryptonote::tx_to_blob (const transaction &tx, blobdata &b_blob)
 
void cryptonote::get_tx_tree_hash (const std::vector< crypto::hash > &tx_hashes, crypto::hash &h)
 
crypto::hash cryptonote::get_tx_tree_hash (const std::vector< crypto::hash > &tx_hashes)
 
crypto::hash cryptonote::get_tx_tree_hash (const block &b)
 
bool cryptonote::is_valid_decomposed_amount (uint64_t amount)
 
void cryptonote::get_hash_stats (uint64_t &tx_hashes_calculated, uint64_t &tx_hashes_cached, uint64_t &block_hashes_calculated, uint64_t &block_hashes_cached)
 
crypto::secret_key cryptonote::encrypt_key (crypto::secret_key key, const epee::wipeable_string &passphrase)
 
crypto::secret_key cryptonote::decrypt_key (crypto::secret_key key, const epee::wipeable_string &passphrase)
 

Macro Definition Documentation

◆ CHECK_AND_ASSERT_THROW_MES_L1

#define CHECK_AND_ASSERT_THROW_MES_L1 (   expr,
  message 
)    {if(!(expr)) {MWARNING(message); throw std::runtime_error(message);}}

Definition at line 84 of file cryptonote_format_utils.cpp.

◆ ELECTRONEUM_DEFAULT_LOG_CATEGORY

#define ELECTRONEUM_DEFAULT_LOG_CATEGORY   "cn"

Definition at line 46 of file cryptonote_format_utils.cpp.

◆ ENCRYPTED_PAYMENT_ID_TAIL

#define ENCRYPTED_PAYMENT_ID_TAIL   0x8d

Definition at line 48 of file cryptonote_format_utils.cpp.