40 #include <unordered_map> 41 #include <boost/multiprecision/cpp_int.hpp> 45 class wipeable_string;
70 field = boost::get<T>(*it);
75 bool sort_tx_extra(
const std::vector<uint8_t>& tx_extra, std::vector<uint8_t> &sorted_tx_extra,
bool allow_partial =
false);
95 bool 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_public_keys,
size_t output_index,
const boost::optional<crypto::view_tag>& view_tag_opt = boost::optional<crypto::view_tag>());
101 boost::optional<subaddress_receive_info>
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 = boost::optional<crypto::view_tag>());
156 template<
class t_
object>
164 template<
class t_
object>
167 std::stringstream ss;
174 template<
class t_
object>
182 template<
class t_
object>
189 template<
class t_
object>
196 template<
class t_
object>
200 blob_size = bl.size();
205 template <
typename T>
208 std::stringstream ss;
211 CHECK_AND_ASSERT_MES(
r,
"",
"obj_to_json_str failed: serialization::serialize returned false");
216 template<
typename chunk_handler_t,
typename dust_handler_t>
224 bool is_dust_handled =
false;
233 if (dust + chunk <= dust_threshold)
239 if (!is_dust_handled && 0 != dust)
242 is_dust_handled =
true;
246 chunk_handler(chunk);
251 if (!is_dust_handled && 0 != dust)
269 #define CHECKED_GET_SPECIFIC_VARIANT(variant_var, specific_type, variable_name, fail_return_val) \ 270 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()); \ 271 specific_type& variable_name = boost::get<specific_type>(variant_var); const char * res
Definition: hmac_keccak.cpp:42
bool parse_tx_extra(const std::vector< uint8_t > &tx_extra, std::vector< tx_extra_field > &tx_extra_fields)
Definition: cryptonote_format_utils.cpp:567
void 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)
Definition: cryptonote_format_utils.cpp:956
bool check_outs_overflow(const transaction &tx)
Definition: cryptonote_format_utils.cpp:903
bool parse_and_validate_block_from_blob(const blobdata_ref &b_blob, block &b, crypto::hash *block_hash)
Definition: cryptonote_format_utils.cpp:1553
uint64_t get_outs_money_amount(const transaction &tx)
Definition: cryptonote_format_utils.cpp:915
const uint32_t T[512]
Definition: groestl_tables.h:36
bool get_tx_fee(const transaction &tx, uint64_t &fee)
Definition: cryptonote_format_utils.cpp:537
binary_archive< false > ar
Definition: cold-outputs.cpp:54
subaddress_index index
Definition: cryptonote_format_utils.h:98
bool check_outs_valid(const transaction &tx)
Definition: cryptonote_format_utils.cpp:866
bool 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)
Definition: cryptonote_format_utils.cpp:756
bool 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)
Definition: cryptonote_format_utils.cpp:1006
Definition: cryptonote_basic.h:538
uint64_t round_money_up(uint64_t amount, unsigned significant_digits)
Definition: cryptonote_format_utils.cpp:1196
#define CRYPTONOTE_DISPLAY_DECIMAL_POINT
Definition: cryptonote_config.h:65
::std::string string
Definition: gtest-port.h:1097
uint64_t get_pruned_transaction_weight(const transaction &tx)
Definition: cryptonote_format_utils.cpp:461
POD_CLASS key_derivation
Definition: crypto.h:88
Definition: cryptonote_basic.h:474
crypto::key_derivation derivation
Definition: cryptonote_format_utils.h:99
size_t get_object_blobsize(const t_object &o)
Definition: cryptonote_format_utils.h:190
t
Definition: console.py:33
void decompose_amount_into_digits(uint64_t amount, uint64_t dust_threshold, const chunk_handler_t &chunk_handler, const dust_handler_t &dust_handler)
Definition: cryptonote_format_utils.h:217
void get_blob_hash(const blobdata_ref &blob, crypto::hash &res)
Definition: cryptonote_format_utils.cpp:1116
const char * key
Definition: hmac_keccak.cpp:40
int type
Definition: superscalar.cpp:50
static bool is_v1_tx(MDB_cursor *c_txs_pruned, MDB_val *tx_id)
Definition: db_lmdb.cpp:2037
Definition: binary_archive.h:180
bool get_output_public_key(const cryptonote::tx_out &out, crypto::public_key &output_public_key)
Definition: cryptonote_format_utils.cpp:923
bool find_tx_extra_field_by_type(const std::vector< tx_extra_field > &tx_extra_fields, T &field, size_t index=0)
Definition: cryptonote_format_utils.h:64
std::vector< uint64_t > relative_output_offsets_to_absolute(const std::vector< uint64_t > &off)
Definition: cryptonote_format_utils.cpp:1533
bool add_additional_tx_pub_keys_to_extra(std::vector< uint8_t > &tx_extra, const std::vector< crypto::public_key > &additional_pub_keys)
Definition: cryptonote_format_utils.cpp:723
POD_CLASS view_tag
Definition: crypto.h:103
std::string get_unit(unsigned int decimal_point)
Definition: cryptonote_format_utils.cpp:1147
unsigned char uint8_t
Definition: stdint.h:124
bool parse_and_validate_tx_base_from_blob(const blobdata_ref &tx_blob, transaction &tx)
Definition: cryptonote_format_utils.cpp:235
uint64_t get_transaction_weight(const transaction &tx, size_t blob_size)
Definition: cryptonote_format_utils.cpp:445
bool get_object_hash(const t_object &o, crypto::hash &res)
Definition: cryptonote_format_utils.h:183
crypto::secret_key encrypt_key(crypto::secret_key key, const epee::wipeable_string &passphrase)
Definition: cryptonote_format_utils.cpp:1639
bool calculate_transaction_hash(const transaction &t, crypto::hash &res, size_t *blob_size)
Definition: cryptonote_format_utils.cpp:1365
bool calculate_block_hash(const block &b, crypto::hash &res, const blobdata_ref *blob)
Definition: cryptonote_format_utils.cpp:1462
bool parse_and_validate_tx_from_blob(const blobdata_ref &tx_blob, transaction &tx)
Definition: cryptonote_format_utils.cpp:224
boost::optional< crypto::view_tag > get_output_view_tag(const cryptonote::tx_out &out)
Definition: cryptonote_format_utils.cpp:940
boost::string_ref blobdata_ref
Definition: blobdatatype.h:40
uint64_t get_transaction_blob_size(const transaction &tx)
Definition: cryptonote_format_utils.cpp:524
static const unsigned long long order[16]
Definition: sc25519_from32bytes.c:8
Holds cryptonote related classes and helpers.
Definition: blockchain_db.cpp:44
binary_archive< false > ba
Definition: bulletproof.cpp:40
bool parse_amount(uint64_t &amount, const std::string &str_amount_)
Definition: cryptonote_format_utils.cpp:410
blobdata tx_to_blob(const transaction &tx)
Definition: cryptonote_format_utils.cpp:1589
bool is_valid_decomposed_amount(uint64_t amount)
Definition: cryptonote_format_utils.cpp:1624
bool add_tx_pub_key_to_extra(transaction &tx, const crypto::public_key &tx_pub_key)
Definition: cryptonote_format_utils.cpp:688
unsigned int get_default_decimal_point()
Definition: cryptonote_format_utils.cpp:1142
Definition: json_archive.h:119
bool 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)
Definition: cryptonote_format_utils.cpp:321
Definition: binary_archive.h:93
Definition: chaingen.h:294
Definition: argon2_core.h:74
bool get_inputs_money_amount(const transaction &tx, uint64_t &money)
Definition: cryptonote_format_utils.cpp:836
bool check_inputs_types_supported(const transaction &tx)
Definition: cryptonote_format_utils.cpp:854
void get_transaction_prefix_hash(const transaction_prefix &tx, crypto::hash &h, hw::device &hwdev)
Definition: cryptonote_format_utils.cpp:131
bool get_block_hash(const block &b, crypto::hash &res)
Definition: cryptonote_format_utils.cpp:1507
bool check_money_overflow(const transaction &tx)
Definition: cryptonote_format_utils.cpp:885
std::vector< uint64_t > absolute_output_offsets_to_relative(const std::vector< uint64_t > &off)
Definition: cryptonote_format_utils.cpp:1541
void serialize(Archive &a, unsigned_tx_set &x, const boost::serialization::version_type ver)
Definition: serialization.cpp:898
blobdata get_block_hashing_blob(const block &b)
Definition: cryptonote_format_utils.cpp:1453
std::string obj_to_json_str(T &obj)
Definition: cryptonote_format_utils.h:206
unsigned __int64 uint64_t
Definition: stdint.h:136
Definition: subaddress_index.h:38
bool t_serializable_object_to_blob(const t_object &to, blobdata &b_blob)
Definition: cryptonote_format_utils.h:165
bool 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)
Definition: cryptonote_format_utils.cpp:290
bool get_payment_id_from_tx_extra_nonce(const blobdata &extra_nonce, crypto::hash &payment_id)
Definition: cryptonote_format_utils.cpp:816
crypto::public_key get_tx_pub_key_from_extra(const std::vector< uint8_t > &tx_extra, size_t pk_index)
Definition: cryptonote_format_utils.cpp:666
Definition: device.hpp:87
crypto::hash get_pruned_transaction_hash(const transaction &t, const crypto::hash &pruned_data_hash)
Definition: cryptonote_format_utils.cpp:1329
bool t_serializable_object_from_blob(t_object &to, const blobdata &b_blob)
Definition: cryptonote_format_utils.h:157
POD_CLASS public_key
Definition: crypto.h:61
void set_default_decimal_point(unsigned int decimal_point)
Definition: cryptonote_format_utils.cpp:1126
bool get_encrypted_payment_id_from_tx_extra_nonce(const blobdata &extra_nonce, crypto::hash8 &payment_id)
Definition: cryptonote_format_utils.cpp:826
bool calculate_transaction_prunable_hash(const transaction &t, const cryptonote::blobdata_ref *blob, crypto::hash &res)
Definition: cryptonote_format_utils.cpp:1285
bool check_inputs_overflow(const transaction &tx)
Definition: cryptonote_format_utils.cpp:890
r
Definition: testupnpigd.py:61
std::string blobdata
Definition: blobdatatype.h:39
crypto::hash get_transaction_prunable_hash(const transaction &t, const cryptonote::blobdata_ref *blobdata)
Definition: cryptonote_format_utils.cpp:1310
boost::variant< tx_extra_padding, tx_extra_pub_key, tx_extra_nonce, tx_extra_merge_mining_tag, tx_extra_additional_pub_keys, tx_extra_mysterious_minergate > tx_extra_field
Definition: tx_extra.h:181
TODO: (mj-xmr) This will be reduced in an another PR.
Definition: byte_slice.h:39
POD_CLASS hash8
Definition: hash.h:52
bool sort_tx_extra(const std::vector< uint8_t > &tx_extra, std::vector< uint8_t > &sorted_tx_extra, bool allow_partial)
Definition: cryptonote_format_utils.cpp:603
POD_CLASS key_image
Definition: crypto.h:92
bool parse_and_validate_tx_prefix_from_blob(const blobdata_ref &tx_blob, transaction_prefix &tx)
Definition: cryptonote_format_utils.cpp:245
crypto::hash get_transaction_hash(const transaction &t)
Definition: cryptonote_format_utils.cpp:1273
bool remove_field_from_tx_extra(std::vector< uint8_t > &tx_extra, const std::type_info &type)
Definition: cryptonote_format_utils.cpp:775
bool add_extra_nonce_to_tx_extra(std::vector< uint8_t > &tx_extra, const blobdata &extra_nonce)
Definition: cryptonote_format_utils.cpp:740
cryptonote::transaction tx
Definition: transaction.cpp:40
Definition: wipeable_string.h:40
crypto::secret_key decrypt_key(crypto::secret_key key, const epee::wipeable_string &passphrase)
Definition: cryptonote_format_utils.cpp:1647
POD_CLASS hash
Definition: hash.h:49
void get_tx_tree_hash(const std::vector< crypto::hash > &tx_hashes, crypto::hash &h)
Definition: cryptonote_format_utils.cpp:1599
void set_encrypted_payment_id_to_tx_extra_nonce(blobdata &extra_nonce, const crypto::hash8 &payment_id)
Definition: cryptonote_format_utils.cpp:808
bool check_output_types(const transaction &tx, const uint8_t hf_version)
Definition: cryptonote_format_utils.cpp:974
void get_hash_stats(uint64_t &tx_hashes_calculated, uint64_t &tx_hashes_cached, uint64_t &block_hashes_calculated, uint64_t &block_hashes_cached)
Definition: cryptonote_format_utils.cpp:1631
void set_payment_id_to_tx_extra_nonce(blobdata &extra_nonce, const crypto::hash &payment_id)
Definition: cryptonote_format_utils.cpp:800
std::string print_money(uint64_t amount, unsigned int decimal_point)
Definition: cryptonote_format_utils.cpp:1180
std::vector< crypto::public_key > get_additional_tx_pub_keys_from_extra(const std::vector< uint8_t > &tx_extra)
Definition: cryptonote_format_utils.cpp:706
bool lookup_acc_outs(const account_keys &acc, const transaction &tx, std::vector< size_t > &outs, uint64_t &money_transfered)
Definition: cryptonote_format_utils.cpp:1088
Definition: cryptonote_basic.h:157
bool 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)
Definition: cryptonote_format_utils.cpp:1031
blobdata block_to_blob(const block &b)
Definition: cryptonote_format_utils.cpp:1579
Definition: cryptonote_format_utils.h:96
static uint64_t h
Definition: blockchain_stats.cpp:55
Definition: cryptonote_basic.h:204
uint64_t get_block_height(const block &b)
Definition: cryptonote_format_utils.cpp:847
cryptonote::block b
Definition: block.cpp:40
std::string short_hash_str(const crypto::hash &h)
Definition: cryptonote_format_utils.cpp:947
boost::optional< subaddress_receive_info > 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)
Definition: cryptonote_format_utils.cpp:1061