Monero
Loading...
Searching...
No Matches
cryptonote_format_utils.cpp File Reference
#include <atomic>
#include <boost/algorithm/string.hpp>
#include "wipeable_string.h"
#include "string_tools.h"
#include "string_tools_lexical.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:

Namespaces

namespace  cryptonote
 Holds cryptonote related classes and helpers.

Macros

#define MONERO_DEFAULT_LOG_CATEGORY   "cn"
#define CHECK_AND_ASSERT_THROW_MES_L1(expr, message)

Functions

static std::atomic< unsigned int > default_decimal_point (CRYPTONOTE_DISPLAY_DECIMAL_POINT)
static std::atomic< uint64_ttx_hashes_calculated_count (0)
static std::atomic< uint64_ttx_hashes_cached_count (0)
static std::atomic< uint64_tblock_hashes_calculated_count (0)
static std::atomic< uint64_tblock_hashes_cached_count (0)
static unsigned char * cryptonote::operator& (ec_point &point)
static const unsigned char * cryptonote::operator& (const ec_point &point)
static void cryptonote::add_public_key (crypto::public_key &AB, const crypto::public_key &A, const crypto::public_key &B)
uint64_t cryptonote::get_transaction_weight_clawback (const transaction &tx, size_t n_padded_outputs)
void cryptonote::get_transaction_prefix_hash (const transaction_prefix &tx, crypto::hash &h, hw::device &hwdev)
crypto::hash cryptonote::get_transaction_prefix_hash (const transaction_prefix &tx, hw::device &hwdev)
bool cryptonote::expand_transaction_1 (transaction &tx, bool base_only)
bool cryptonote::parse_and_validate_tx_from_blob (const blobdata_ref &tx_blob, transaction &tx)
bool cryptonote::parse_and_validate_tx_base_from_blob (const blobdata_ref &tx_blob, transaction &tx)
bool cryptonote::parse_and_validate_tx_prefix_from_blob (const blobdata_ref &tx_blob, transaction_prefix &tx)
bool cryptonote::parse_and_validate_tx_from_blob (const blobdata_ref &tx_blob, transaction &tx, crypto::hash &tx_hash)
bool cryptonote::parse_and_validate_tx_from_blob (const blobdata_ref &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)
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)
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_pruned_transaction_weight (const transaction &tx)
uint64_t cryptonote::get_transaction_weight (const transaction &tx)
uint64_t cryptonote::get_transaction_blob_size (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)
template<typename T>
static bool cryptonote::pick (binary_archive< true > &ar, std::vector< tx_extra_field > &fields, uint8_t tag)
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_mm_merkle_root_to_tx_extra (std::vector< uint8_t > &tx_extra, const crypto::hash &mm_merkle_root, size_t mm_merkle_tree_depth)
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_money_amount (const transaction &tx, uint64_t &money)
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_money_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_money_amount (const transaction &tx)
bool cryptonote::get_output_public_key (const cryptonote::tx_out &out, crypto::public_key &output_public_key)
boost::optional< crypto::view_tagcryptonote::get_output_view_tag (const cryptonote::tx_out &out)
std::string cryptonote::short_hash_str (const crypto::hash &h)
void cryptonote::set_tx_out (const uint64_t amount, const crypto::public_key &output_public_key, const bool use_view_tags, const crypto::view_tag &view_tag, tx_out &out)
bool cryptonote::check_output_types (const transaction &tx, const uint8_t hf_version)
bool cryptonote::out_can_be_to_acc (const boost::optional< crypto::view_tag > &view_tag_opt, const crypto::key_derivation &derivation, const size_t output_index, hw::device *hwdev)
bool cryptonote::is_out_to_acc (const account_keys &acc, const crypto::public_key &output_public_key, const crypto::public_key &tx_pub_key, const std::vector< crypto::public_key > &additional_tx_pub_keys, size_t output_index, const boost::optional< crypto::view_tag > &view_tag_opt)
boost::optional< subaddress_receive_infocryptonote::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, const boost::optional< crypto::view_tag > &view_tag_opt)
bool cryptonote::lookup_acc_outs (const account_keys &acc, const transaction &tx, std::vector< size_t > &outs, uint64_t &money_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 &money_transfered)
void cryptonote::get_blob_hash (const blobdata_ref &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)
static void cryptonote::insert_money_decimal_point (std::string &s, unsigned int decimal_point)
std::string cryptonote::print_money (uint64_t amount, unsigned int decimal_point)
std::string cryptonote::print_money (const boost::multiprecision::uint128_t &amount, unsigned int decimal_point)
uint64_t cryptonote::round_money_up (uint64_t amount, unsigned significant_digits)
std::string cryptonote::round_money_up (const std::string &s, unsigned significant_digits)
crypto::hash cryptonote::get_blob_hash (const blobdata &blob)
crypto::hash cryptonote::get_blob_hash (const blobdata_ref &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_ref *blob, crypto::hash &res)
crypto::hash cryptonote::get_transaction_prunable_hash (const transaction &t, const cryptonote::blobdata_ref *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_ref *blob)
bool cryptonote::get_block_hash (const block &b, crypto::hash &res)
crypto::hash cryptonote::get_block_hash (const block &b)
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)
bool cryptonote::parse_and_validate_block_from_blob (const blobdata_ref &b_blob, block &b, crypto::hash *block_hash)
bool cryptonote::parse_and_validate_block_from_blob (const blobdata_ref &b_blob, block &b)
bool cryptonote::parse_and_validate_block_from_blob (const blobdata_ref &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)

Variables

static const uint64_t valid_decomposed_outputs []

Macro Definition Documentation

◆ CHECK_AND_ASSERT_THROW_MES_L1

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

◆ MONERO_DEFAULT_LOG_CATEGORY

#define MONERO_DEFAULT_LOG_CATEGORY   "cn"

Function Documentation

◆ block_hashes_cached_count()

std::atomic< uint64_t > block_hashes_cached_count ( 0 )
static

◆ block_hashes_calculated_count()

std::atomic< uint64_t > block_hashes_calculated_count ( 0 )
static

◆ default_decimal_point()

std::atomic< unsigned int > default_decimal_point ( CRYPTONOTE_DISPLAY_DECIMAL_POINT )
static

◆ tx_hashes_cached_count()

std::atomic< uint64_t > tx_hashes_cached_count ( 0 )
static

◆ tx_hashes_calculated_count()

std::atomic< uint64_t > tx_hashes_calculated_count ( 0 )
static

Variable Documentation

◆ valid_decomposed_outputs

const uint64_t valid_decomposed_outputs[]
static
Initial value:
= {
(uint64_t)10, (uint64_t)20, (uint64_t)30, (uint64_t)40, (uint64_t)50, (uint64_t)60, (uint64_t)70, (uint64_t)80, (uint64_t)90,
(uint64_t)100, (uint64_t)200, (uint64_t)300, (uint64_t)400, (uint64_t)500, (uint64_t)600, (uint64_t)700, (uint64_t)800, (uint64_t)900,
(uint64_t)1000, (uint64_t)2000, (uint64_t)3000, (uint64_t)4000, (uint64_t)5000, (uint64_t)6000, (uint64_t)7000, (uint64_t)8000, (uint64_t)9000,
(uint64_t)10000, (uint64_t)20000, (uint64_t)30000, (uint64_t)40000, (uint64_t)50000, (uint64_t)60000, (uint64_t)70000, (uint64_t)80000, (uint64_t)90000,
(uint64_t)100000, (uint64_t)200000, (uint64_t)300000, (uint64_t)400000, (uint64_t)500000, (uint64_t)600000, (uint64_t)700000, (uint64_t)800000, (uint64_t)900000,
(uint64_t)1000000, (uint64_t)2000000, (uint64_t)3000000, (uint64_t)4000000, (uint64_t)5000000, (uint64_t)6000000, (uint64_t)7000000, (uint64_t)8000000, (uint64_t)9000000,
(uint64_t)10000000, (uint64_t)20000000, (uint64_t)30000000, (uint64_t)40000000, (uint64_t)50000000, (uint64_t)60000000, (uint64_t)70000000, (uint64_t)80000000, (uint64_t)90000000,
(uint64_t)100000000, (uint64_t)200000000, (uint64_t)300000000, (uint64_t)400000000, (uint64_t)500000000, (uint64_t)600000000, (uint64_t)700000000, (uint64_t)800000000, (uint64_t)900000000,
(uint64_t)1000000000, (uint64_t)2000000000, (uint64_t)3000000000, (uint64_t)4000000000, (uint64_t)5000000000, (uint64_t)6000000000, (uint64_t)7000000000, (uint64_t)8000000000, (uint64_t)9000000000,
(uint64_t)10000000000, (uint64_t)20000000000, (uint64_t)30000000000, (uint64_t)40000000000, (uint64_t)50000000000, (uint64_t)60000000000, (uint64_t)70000000000, (uint64_t)80000000000, (uint64_t)90000000000,
(uint64_t)100000000000, (uint64_t)200000000000, (uint64_t)300000000000, (uint64_t)400000000000, (uint64_t)500000000000, (uint64_t)600000000000, (uint64_t)700000000000, (uint64_t)800000000000, (uint64_t)900000000000,
(uint64_t)1000000000000, (uint64_t)2000000000000, (uint64_t)3000000000000, (uint64_t)4000000000000, (uint64_t)5000000000000, (uint64_t)6000000000000, (uint64_t)7000000000000, (uint64_t)8000000000000, (uint64_t)9000000000000,
(uint64_t)10000000000000, (uint64_t)20000000000000, (uint64_t)30000000000000, (uint64_t)40000000000000, (uint64_t)50000000000000, (uint64_t)60000000000000, (uint64_t)70000000000000, (uint64_t)80000000000000, (uint64_t)90000000000000,
(uint64_t)100000000000000, (uint64_t)200000000000000, (uint64_t)300000000000000, (uint64_t)400000000000000, (uint64_t)500000000000000, (uint64_t)600000000000000, (uint64_t)700000000000000, (uint64_t)800000000000000, (uint64_t)900000000000000,
(uint64_t)1000000000000000, (uint64_t)2000000000000000, (uint64_t)3000000000000000, (uint64_t)4000000000000000, (uint64_t)5000000000000000, (uint64_t)6000000000000000, (uint64_t)7000000000000000, (uint64_t)8000000000000000, (uint64_t)9000000000000000,
(uint64_t)10000000000000000, (uint64_t)20000000000000000, (uint64_t)30000000000000000, (uint64_t)40000000000000000, (uint64_t)50000000000000000, (uint64_t)60000000000000000, (uint64_t)70000000000000000, (uint64_t)80000000000000000, (uint64_t)90000000000000000,
(uint64_t)100000000000000000, (uint64_t)200000000000000000, (uint64_t)300000000000000000, (uint64_t)400000000000000000, (uint64_t)500000000000000000, (uint64_t)600000000000000000, (uint64_t)700000000000000000, (uint64_t)800000000000000000, (uint64_t)900000000000000000,
(uint64_t)1000000000000000000, (uint64_t)2000000000000000000, (uint64_t)3000000000000000000, (uint64_t)4000000000000000000, (uint64_t)5000000000000000000, (uint64_t)6000000000000000000, (uint64_t)7000000000000000000, (uint64_t)8000000000000000000, (uint64_t)9000000000000000000,
(uint64_t)10000000000000000000ull
}
unsigned __int64 uint64_t
Definition stdint.h:136