41 #include <unordered_map> 45 class wipeable_string;
64 auto it = std::find_if(tx_extra_fields.begin(), tx_extra_fields.end(), [&index](
const tx_extra_field& f) {
return typeid(
T) == f.type() && !index--; });
65 if(tx_extra_fields.end() == it)
68 field = boost::get<T>(*it);
72 bool parse_tx_extra(
const std::vector<uint8_t>& tx_extra, std::vector<tx_extra_field>& tx_extra_fields);
73 bool sort_tx_extra(
const std::vector<uint8_t>& tx_extra, std::vector<uint8_t> &sorted_tx_extra,
bool allow_partial =
false);
103 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,
const uint32_t account_major_offset = 0);
148 template<
class t_
object>
151 std::stringstream ss;
158 template<
class t_
object>
161 std::stringstream ss;
168 template<
class t_
object>
176 template<
class t_
object>
183 template<
class t_
object>
190 template<
class t_
object>
194 blob_size = bl.size();
199 template <
typename T>
202 std::stringstream ss;
210 template<
typename chunk_handler_t,
typename dust_handler_t>
218 bool is_dust_handled =
false;
223 uint64_t chunk = (amount % 10) * order;
227 if (dust + chunk <= dust_threshold)
233 if (!is_dust_handled && 0 != dust)
236 is_dust_handled =
true;
240 chunk_handler(chunk);
245 if (!is_dust_handled && 0 != dust)
263 #define CHECKED_GET_SPECIFIC_VARIANT(variant_var, specific_type, variable_name, fail_return_val) \ 264 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()); \ 265 specific_type& variable_name = boost::get<specific_type>(variant_var);
bool parse_tx_extra(const std::vector< uint8_t > &tx_extra, std::vector< tx_extra_field > &tx_extra_fields)
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, const uint32_t account_major_offset)
bool check_outs_overflow(const transaction &tx)
bool get_tx_fee(const transaction &tx, uint64_t &fee)
bool check_outs_valid(const transaction &tx)
void get_blob_hash(const epee::span< const char > &blob, crypto::hash &res)
#define CRYPTONOTE_DISPLAY_DECIMAL_POINT
uint64_t get_outs_etn_amount(const transaction &tx)
crypto::key_derivation derivation
std::string print_etn(uint64_t amount, unsigned int decimal_point)
#define CHECK_AND_ASSERT_MES(expr, fail_ret_val, message)
size_t get_object_blobsize(const t_object &o)
void decompose_amount_into_digits(uint64_t amount, uint64_t dust_threshold, const chunk_handler_t &chunk_handler, const dust_handler_t &dust_handler)
bool add_bridge_smartchain_address_to_tx_extra(std::vector< uint8_t > &tx_extra, const blobdata &bridge_smartchain_address)
boost::variant< tx_extra_padding, tx_extra_pub_key, tx_extra_nonce, tx_extra_merge_mining_tag, tx_extra_additional_pub_keys, tx_extra_bridge_source_address, tx_extra_bridge_smartchain_address, tx_extra_mysterious_minergate > tx_extra_field
bool parse_and_validate_tx_prefix_from_blob(const blobdata &tx_blob, transaction_prefix &tx)
bool add_bridge_source_address_to_tx_extra(std::vector< uint8_t > &tx_extra, const blobdata &bridge_source_address)
bool find_tx_extra_field_by_type(const std::vector< tx_extra_field > &tx_extra_fields, T &field, size_t index=0)
Non-owning sequence of data. Does not deep copy.
std::vector< uint64_t > relative_output_offsets_to_absolute(const std::vector< uint64_t > &off)
bool add_additional_tx_pub_keys_to_extra(std::vector< uint8_t > &tx_extra, const std::vector< crypto::public_key > &additional_pub_keys)
std::string get_unit(unsigned int decimal_point)
uint64_t get_transaction_weight(const transaction &tx, size_t blob_size)
bool get_object_hash(const t_object &o, crypto::hash &res)
crypto::secret_key encrypt_key(crypto::secret_key key, const epee::wipeable_string &passphrase)
bool calculate_transaction_hash(const transaction &t, crypto::hash &res, size_t *blob_size)
Holds cryptonote related classes and helpers.
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)
bool parse_amount(uint64_t &amount, const std::string &str_amount_)
bool get_block_longhash(const block &b, crypto::hash &res, uint64_t height)
blobdata tx_to_blob(const transaction &tx)
bool is_valid_decomposed_amount(uint64_t amount)
bool add_tx_pub_key_to_extra(transaction &tx, const crypto::public_key &tx_pub_key)
unsigned int get_default_decimal_point()
bool calculate_transaction_prunable_hash(const transaction &t, const cryptonote::blobdata *blob, crypto::hash &res)
bool check_inputs_types_supported(const transaction &tx)
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, const uint32_t account_major_offset)
bool get_block_hash(const block &b, crypto::hash &res)
std::vector< uint64_t > absolute_output_offsets_to_relative(const std::vector< uint64_t > &off)
void serialize(Archive &a, unsigned_tx_set &x, const boost::serialization::version_type ver)
blobdata get_block_hashing_blob(const block &b)
std::string obj_to_json_str(T &obj)
unsigned __int64 uint64_t
bool t_serializable_object_to_blob(const t_object &to, blobdata &b_blob)
bool get_payment_id_from_tx_extra_nonce(const blobdata &extra_nonce, crypto::hash &payment_id)
crypto::public_key get_tx_pub_key_from_extra(const std::vector< uint8_t > &tx_extra, size_t pk_index)
bool parse_and_validate_tx_base_from_blob(const blobdata &tx_blob, transaction &tx)
bool parse_and_validate_tx_from_blob(const blobdata &tx_blob, transaction &tx)
crypto::hash get_pruned_transaction_hash(const transaction &t, const crypto::hash &pruned_data_hash)
bool t_serializable_object_from_blob(t_object &to, const blobdata &b_blob)
void set_default_decimal_point(unsigned int decimal_point)
bool get_encrypted_payment_id_from_tx_extra_nonce(const blobdata &extra_nonce, crypto::hash8 &payment_id)
epee::span< const char > blobdata_ref
bool check_inputs_overflow(const transaction &tx)
bool 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)
void get_transaction_prefix_hash(const transaction_prefix &tx, crypto::hash &h)
bool sort_tx_extra(const std::vector< uint8_t > &tx_extra, std::vector< uint8_t > &sorted_tx_extra, bool allow_partial)
crypto::hash get_transaction_hash(const transaction &t)
bool remove_field_from_tx_extra(std::vector< uint8_t > &tx_extra, const std::type_info &type)
bool add_extra_nonce_to_tx_extra(std::vector< uint8_t > &tx_extra, const blobdata &extra_nonce)
bool check_etn_overflow(const transaction &tx)
bool get_inputs_etn_amount(const transaction &tx, uint64_t &etn)
crypto::secret_key decrypt_key(crypto::secret_key key, const epee::wipeable_string &passphrase)
void get_tx_tree_hash(const std::vector< crypto::hash > &tx_hashes, crypto::hash &h)
void set_encrypted_payment_id_to_tx_extra_nonce(blobdata &extra_nonce, const crypto::hash8 &payment_id)
void get_hash_stats(uint64_t &tx_hashes_calculated, uint64_t &tx_hashes_cached, uint64_t &block_hashes_calculated, uint64_t &block_hashes_cached)
void set_payment_id_to_tx_extra_nonce(blobdata &extra_nonce, const crypto::hash &payment_id)
std::vector< crypto::public_key > get_additional_tx_pub_keys_from_extra(const std::vector< uint8_t > &tx_extra)
blobdata block_to_blob(const block &b)
boost::optional< subaddress_receive_info > is_out_to_acc_precomp_public(const std::unordered_map< crypto::public_key, subaddress_index > &subaddresses, const cryptonote::account_public_address output_address)
crypto::hash get_transaction_prunable_hash(const transaction &t, const cryptonote::blobdata *blobdata)
bool is_v1_tx(const blobdata_ref &tx_blob)
bool calculate_block_hash(const block &b, crypto::hash &res, const blobdata *blob)
uint64_t get_block_height(const block &b)
bool parse_and_validate_block_from_blob(const blobdata &b_blob, block &b, crypto::hash *block_hash)
std::string short_hash_str(const crypto::hash &h)
bool lookup_acc_outs(const account_keys &acc, const transaction &tx, std::vector< size_t > &outs, uint64_t &etn_transfered)