Monero
Loading...
Searching...
No Matches
cryptonote_format_utils.h File Reference
#include "blobdatatype.h"
#include "cryptonote_basic_impl.h"
#include "tx_extra.h"
#include "account.h"
#include "subaddress_index.h"
#include "include_base_utils.h"
#include "crypto/crypto.h"
#include "crypto/hash.h"
#include <unordered_map>
#include <boost/multiprecision/cpp_int.hpp>
Include dependency graph for cryptonote_format_utils.h:

Go to the source code of this file.

Classes

struct  cryptonote::subaddress_receive_info

Namespaces

namespace  epee
 TODO: (mj-xmr) This will be reduced in an another PR.
namespace  cryptonote
 Holds cryptonote related classes and helpers.

Macros

#define CHECKED_GET_SPECIFIC_VARIANT(variant_var, specific_type, variable_name, fail_return_val)

Functions

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)
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::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, crypto::hash &tx_prefix_hash)
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)
bool cryptonote::parse_and_validate_tx_base_from_blob (const blobdata_ref &tx_blob, transaction &tx)
bool cryptonote::is_v1_tx (const blobdata_ref &tx_blob)
bool cryptonote::is_v1_tx (const blobdata &tx_blob)
template<typename T>
bool cryptonote::find_tx_extra_field_by_type (const std::vector< tx_extra_field > &tx_extra_fields, T &field, size_t index=0)
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=false)
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)
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, 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)
bool cryptonote::lookup_acc_outs (const account_keys &acc, const transaction &tx, std::vector< size_t > &outs, uint64_t &money_transfered)
bool cryptonote::get_tx_fee (const transaction &tx, uint64_t &fee)
uint64_t cryptonote::get_tx_fee (const transaction &tx)
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)
void cryptonote::get_blob_hash (const blobdata &blob, crypto::hash &res)
void cryptonote::get_blob_hash (const blobdata_ref &blob, crypto::hash &res)
crypto::hash cryptonote::get_blob_hash (const blobdata &blob)
crypto::hash cryptonote::get_blob_hash (const blobdata_ref &blob)
std::string cryptonote::short_hash_str (const crypto::hash &h)
crypto::hash cryptonote::get_transaction_hash (const transaction &t)
bool cryptonote::get_transaction_hash (const transaction &t, crypto::hash &res)
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)
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)
bool cryptonote::calculate_transaction_hash (const transaction &t, crypto::hash &res, size_t *blob_size)
crypto::hash cryptonote::get_pruned_transaction_hash (const transaction &t, const crypto::hash &pruned_data_hash)
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)
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)
bool cryptonote::get_inputs_money_amount (const transaction &tx, uint64_t &money)
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)
bool cryptonote::check_inputs_types_supported (const transaction &tx)
bool cryptonote::check_outs_valid (const transaction &tx)
bool cryptonote::parse_amount (uint64_t &amount, const std::string &str_amount_)
uint64_t cryptonote::get_transaction_weight (const transaction &tx)
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_blob_size (const transaction &tx)
bool cryptonote::check_money_overflow (const transaction &tx)
bool cryptonote::check_outs_overflow (const transaction &tx)
bool cryptonote::check_inputs_overflow (const transaction &tx)
uint64_t cryptonote::get_block_height (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)
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_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)
template<class t_object>
bool cryptonote::t_serializable_object_from_blob (t_object &to, const blobdata &b_blob)
template<class t_object>
bool cryptonote::t_serializable_object_to_blob (const t_object &to, blobdata &b_blob)
template<class t_object>
blobdata cryptonote::t_serializable_object_to_blob (const t_object &to)
template<class t_object>
bool cryptonote::get_object_hash (const t_object &o, crypto::hash &res)
template<class t_object>
size_t cryptonote::get_object_blobsize (const t_object &o)
template<class t_object>
bool cryptonote::get_object_hash (const t_object &o, crypto::hash &res, size_t &blob_size)
template<typename T>
std::string cryptonote::obj_to_json_str (T &obj)
template<typename chunk_handler_t, typename dust_handler_t>
void cryptonote::decompose_amount_into_digits (uint64_t amount, uint64_t dust_threshold, const chunk_handler_t &chunk_handler, const dust_handler_t &dust_handler)
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

◆ CHECKED_GET_SPECIFIC_VARIANT

#define CHECKED_GET_SPECIFIC_VARIANT ( variant_var,
specific_type,
variable_name,
fail_return_val )
Value:
CHECK_AND_ASSERT_MES(variant_var.type() == typeid(specific_type), fail_return_val, "wrong variant type: " << variant_var.type().name() << ", expected " << typeid(specific_type).name()); \
specific_type& variable_name = boost::get<specific_type>(variant_var);