33 #include <boost/algorithm/string.hpp> 45 #undef ELECTRONEUM_DEFAULT_LOG_CATEGORY 46 #define ELECTRONEUM_DEFAULT_LOG_CATEGORY "cn" 48 #define ENCRYPTED_PAYMENT_ID_TAIL 0x8d 54 static const uint64_t valid_decomposed_outputs[] = {
79 static std::atomic<uint64_t> tx_hashes_calculated_count(0);
80 static std::atomic<uint64_t> tx_hashes_cached_count(0);
81 static std::atomic<uint64_t> block_hashes_calculated_count(0);
82 static std::atomic<uint64_t> block_hashes_cached_count(0);
84 #define CHECK_AND_ASSERT_THROW_MES_L1(expr, message) {if(!(expr)) {MWARNING(message); throw std::runtime_error(message);}} 89 return &
reinterpret_cast<unsigned char &
>(point);
92 return &
reinterpret_cast<const unsigned char &
>(point);
103 ge_add(&tmp3, &A2, &tmp2);
114 std::ostringstream s;
135 std::stringstream ss;
148 std::stringstream ss;
151 bool r = tx.serialize_base(ba);
160 std::stringstream ss;
170 std::stringstream ss;
196 const char* begin =
static_cast<const char*
>(tx_blob.
data());
197 const char* end = begin + tx_blob.
size();
198 int read = tools::read_varint(begin, end,
version);
200 throw std::runtime_error(
"Internal error getting transaction version");
208 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)
214 MWARNING(
"key image helper: failed to generate_key_derivation(" << tx_public_key <<
", " << ack.
m_view_secret_key <<
")");
218 std::vector<crypto::key_derivation> additional_recv_derivations;
219 for (
size_t i = 0; i < additional_tx_public_keys.size(); ++i)
225 MWARNING(
"key image helper: failed to generate_key_derivation(" << additional_tx_public_keys[i] <<
", " << ack.
m_view_secret_key <<
")");
229 additional_recv_derivations.push_back(additional_recv_derivation);
233 boost::optional<subaddress_receive_info> subaddr_recv_info =
is_out_to_acc_precomp(subaddresses, out_key, recv_derivation, additional_recv_derivations, real_output_index,hwdev);
234 CHECK_AND_ASSERT_MES(subaddr_recv_info,
false,
"key image helper: given output pubkey doesn't seem to belong to this address");
236 return generate_key_image_helper_precomp(ack, out_key, subaddr_recv_info->derivation, real_output_index, subaddr_recv_info->index, in_ephemeral, ki, hwdev, account_major_offset);
241 uint32_t major_index_offset_based = received_index.
major + (received_index.
major != 0 ? account_major_offset : 0);
244 if (hwdev.
compute_key_image(ack, out_key, recv_derivation, real_output_index, recv_index, in_ephemeral, ki))
252 in_ephemeral.
pub = out_key;
266 scalar_step2 = scalar_step1;
274 in_ephemeral.
sec = scalar_step2;
290 add_public_key(in_ephemeral.
pub, in_ephemeral.
pub, subaddr_pk);
295 false,
"key image helper precomp: given output pubkey doesn't match the derived one");
317 size_t point_index = str_amount.find_first_of(
'.');
318 size_t fraction_size;
319 if (std::string::npos != point_index)
321 fraction_size = str_amount.size() - point_index - 1;
322 while (default_decimal_point < fraction_size &&
'0' == str_amount.back())
324 str_amount.erase(str_amount.size() - 1, 1);
327 if (default_decimal_point < fraction_size)
329 str_amount.erase(point_index, 1);
336 if (str_amount.empty())
339 if (fraction_size < default_decimal_point)
341 str_amount.append(default_decimal_point - fraction_size,
'0');
361 std::ostringstream s;
364 blob_size = s.str().size();
373 for(
auto& in: tx.
vin)
379 amount_in += boost::get<txin_to_key>(in).amount;
383 amount_in += boost::get<txin_to_key_public>(in).amount;
386 for(
auto& o: tx.
vout)
387 amount_out += o.amount;
389 CHECK_AND_ASSERT_MES(amount_in >= amount_out,
false,
"transaction spend (" <<amount_in <<
") more than it has (" << amount_out <<
")");
390 fee = amount_in - amount_out;
402 bool parse_tx_extra(
const std::vector<uint8_t>& tx_extra, std::vector<tx_extra_field>& tx_extra_fields)
404 tx_extra_fields.clear();
409 std::string extra_str(reinterpret_cast<const char*>(tx_extra.data()), tx_extra.size());
410 std::istringstream iss(extra_str);
419 tx_extra_fields.push_back(field);
421 std::ios_base::iostate
state = iss.rdstate();
422 eof = (EOF == iss.peek());
433 std::vector<tx_extra_field>::iterator it;
434 while ((it = std::find_if(fields.begin(), fields.end(), [](
const tx_extra_field &f) {
return f.type() ==
typeid(
T); })) != fields.end())
445 bool sort_tx_extra(
const std::vector<uint8_t>& tx_extra, std::vector<uint8_t> &sorted_tx_extra,
bool allow_partial)
447 std::vector<tx_extra_field> tx_extra_fields;
451 sorted_tx_extra.clear();
455 std::string extra_str(reinterpret_cast<const char*>(tx_extra.data()), tx_extra.size());
456 std::istringstream iss(extra_str);
460 size_t processed = 0;
472 tx_extra_fields.push_back(field);
473 processed = iss.tellg();
475 std::ios_base::iostate
state = iss.rdstate();
476 eof = (EOF == iss.peek());
485 MTRACE(
"Sorted " << processed <<
"/" << tx_extra.size());
487 std::ostringstream oss;
493 if (!pick<tx_extra_nonce>(nar, tx_extra_fields,
TX_EXTRA_NONCE))
return false;
501 if (!tx_extra_fields.empty())
503 MERROR(
"tx_extra_fields not empty after sorting, someone forgot to add a case above");
508 if (allow_partial && processed < tx_extra.size())
510 MDEBUG(
"Appending unparsed data");
511 oss_str +=
std::string((
const char*)tx_extra.data() + processed, tx_extra.size() - processed);
513 sorted_tx_extra = std::vector<uint8_t>(oss_str.begin(), oss_str.end());
519 std::vector<tx_extra_field> tx_extra_fields;
560 std::vector<tx_extra_field> tx_extra_fields;
566 return additional_pub_keys.
data;
579 std::ostringstream oss;
585 size_t pos = tx_extra.size();
586 tx_extra.resize(tx_extra.size() + tx_extra_str.size());
587 memcpy(&tx_extra[pos], tx_extra_str.data(), tx_extra_str.size());
594 size_t start_pos = tx_extra.size();
595 tx_extra.resize(tx_extra.size() + 2 + extra_nonce.size());
600 tx_extra[start_pos] =
static_cast<uint8_t>(extra_nonce.size());
603 memcpy(&tx_extra[start_pos], extra_nonce.data(), extra_nonce.size());
610 size_t start_pos = tx_extra.size();
611 tx_extra.resize(tx_extra.size() + 2 + bridge_source_address.size());
616 tx_extra[start_pos] =
static_cast<uint8_t>(bridge_source_address.size());
619 memcpy(&tx_extra[start_pos], bridge_source_address.data(), bridge_source_address.size());
626 size_t start_pos = tx_extra.size();
627 tx_extra.resize(tx_extra.size() + 2 + bridge_smartchain_address.size());
632 tx_extra[start_pos] =
static_cast<uint8_t>(bridge_smartchain_address.size());
635 memcpy(&tx_extra[start_pos], bridge_smartchain_address.data(), bridge_smartchain_address.size());
641 if (tx_extra.empty())
643 std::string extra_str(reinterpret_cast<const char*>(tx_extra.data()), tx_extra.size());
644 std::istringstream iss(extra_str);
646 std::ostringstream oss;
655 if (field.type() != type)
658 std::ios_base::iostate
state = iss.rdstate();
659 eof = (EOF == iss.peek());
665 tx_extra.reserve(s.size());
666 std::copy(s.begin(), s.end(), std::back_inserter(tx_extra));
674 const uint8_t* payment_id_ptr =
reinterpret_cast<const uint8_t*
>(&payment_id);
675 std::copy(payment_id_ptr, payment_id_ptr +
sizeof(payment_id), std::back_inserter(extra_nonce));
682 const uint8_t* payment_id_ptr =
reinterpret_cast<const uint8_t*
>(&payment_id);
683 std::copy(payment_id_ptr, payment_id_ptr +
sizeof(payment_id), std::back_inserter(extra_nonce));
692 payment_id = *
reinterpret_cast<const crypto::hash*
>(extra_nonce.data() + 1);
702 payment_id = *
reinterpret_cast<const crypto::hash8*
>(extra_nonce.data() + 1);
710 for(
const auto& in: tx.
vin)
713 etn += tokey_in.amount;
718 for(
const auto& in: tx.
vin)
721 etn += tokey_in.amount;
732 return coinbase_in.height;
737 for(
const auto& in: tx.
vin)
767 if(!
check_key(boost::get<txout_to_key>(out.target).key))
778 if(!
check_key(boost::get<txout_to_key_public>(out.target).address.m_spend_public_key) ||
779 !
check_key(boost::get<txout_to_key_public>(out.target).address.m_view_public_key))
797 for(
const auto& in: tx.
vin)
800 if(etn > tokey_in.amount + etn)
802 etn += tokey_in.amount;
807 for(
const auto& in: tx.
vin)
810 if(etn > tokey_in.amount + etn)
812 etn += tokey_in.amount;
820 for(
const auto& o: tx.
vout)
822 if(etn > o.amount + etn)
832 for(
const auto& o: tx.
vout)
833 outputs_amount += o.amount;
834 return outputs_amount;
841 auto erased_pos =
res.erase(8, 48);
842 res.insert(8,
"....");
854 if (pk == out_key.
key)
857 if (!additional_tx_pub_keys.empty())
864 return pk == out_key.
key;
874 auto found = subaddresses.find(subaddress_spendkey);
875 if (found != subaddresses.end())
878 if (!additional_derivations.empty())
882 found = subaddresses.find(subaddress_spendkey);
883 if (found != subaddresses.end())
892 auto found = subaddresses.find(subaddress_spendkey);
893 if (found != subaddresses.end()){
905 return lookup_acc_outs(acc, tx, tx_pub_key, additional_tx_pub_keys, outs, etn_transfered);
910 CHECK_AND_ASSERT_MES(additional_tx_pub_keys.empty() || additional_tx_pub_keys.size() == tx.
vout.size(),
false,
"wrong number of additional pubkeys" );
916 if(
is_out_to_acc(acc, boost::get<txout_to_key>(o.
target), tx_pub_key, additional_tx_pub_keys, i))
919 etn_transfered += o.
amount;
938 switch (decimal_point)
941 default_decimal_point = decimal_point;
950 return default_decimal_point;
955 if (decimal_point == (
unsigned int)-1)
956 decimal_point = default_decimal_point;
957 switch (decimal_point)
960 return "electroneum";
970 if (decimal_point == (
unsigned int)-1)
971 decimal_point = default_decimal_point;
973 if(s.size() < decimal_point+1)
975 s.insert(0, decimal_point+1 - s.size(),
'0');
977 if (decimal_point > 0)
978 s.insert(s.size() - decimal_point,
".");
1014 if (blob && unprunable_size)
1016 CHECK_AND_ASSERT_MES(unprunable_size <= blob->size(),
false,
"Inconsistent transaction unprunable and blob sizes");
1022 std::stringstream ss;
1024 const size_t inputs = t.
vin.size();
1025 const size_t outputs = t.
vout.size();
1026 const size_t mixin = t.
vin.empty() ? 0 : t.
vin[0].type() ==
typeid(
txin_to_key) ? boost::get<txin_to_key>(t.
vin[0]).key_offsets.size() - 1 : 0;
1056 std::stringstream ss;
1058 const size_t inputs = t.
vin.size();
1059 const size_t outputs = t.
vout.size();
1067 hashes[2] = crypto::null_hash;
1069 hashes[2] = pruned_data_hash;
1081 size_t ignored_blob_size, &blob_size_ref = blob_size ? *blob_size : ignored_blob_size;
1096 CHECK_AND_ASSERT_MES(prefix_size <= unprunable_size && unprunable_size <= blob.size(),
false,
"Inconsistent transaction prefix, unprunable and blob sizes");
1102 hashes[2] = crypto::null_hash;
1130 #ifdef ENABLE_HASH_CASH_INTEGRITY_CHECK 1143 ++tx_hashes_cached_count;
1146 ++tx_hashes_calculated_count;
1169 blob.append(reinterpret_cast<const char*>(&tree_root_hash),
sizeof(tree_root_hash));
1183 #ifdef ENABLE_HASH_CASH_INTEGRITY_CHECK 1187 ++block_hashes_cached_count;
1190 ++block_hashes_calculated_count;
1216 std::vector<uint64_t>
res = off;
1217 for(
size_t i = 1; i <
res.size(); i++)
1224 std::vector<uint64_t>
res = off;
1227 std::sort(
res.begin(),
res.end());
1228 for(
size_t i =
res.size()-1; i != 0; i--)
1243 std::stringstream ss;
1253 ++block_hashes_calculated_count;
1254 b.
hash = *block_hash;
1292 tree_hash(tx_hashes.data(), tx_hashes.size(), h);
1304 std::vector<crypto::hash> txs_ids;
1305 txs_ids.reserve(1 + b.
tx_hashes.size());
1309 txs_ids.push_back(h);
1311 txs_ids.push_back(th);
1317 const uint64_t *begin = valid_decomposed_outputs;
1318 const uint64_t *end = valid_decomposed_outputs +
sizeof(valid_decomposed_outputs) /
sizeof(valid_decomposed_outputs[0]);
1319 return std::binary_search(begin, end, amount);
1324 tx_hashes_calculated = tx_hashes_calculated_count;
1325 tx_hashes_cached = tx_hashes_cached_count;
1326 block_hashes_calculated = block_hashes_calculated_count;
1327 block_hashes_cached = block_hashes_cached_count;
1334 sc_add((
unsigned char*)
key.data, (
const unsigned char*)
key.data, (
const unsigned char*)
hash.data);
1342 sc_sub((
unsigned char*)
key.data, (
const unsigned char*)
key.data, (
const unsigned char*)
hash.data);
bool parse_tx_extra(const std::vector< uint8_t > &tx_extra, std::vector< tx_extra_field > &tx_extra_fields)
virtual bool secret_key_to_public_key(const crypto::secret_key &sec, crypto::public_key &pub)=0
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)
#define CHECK_AND_ASSERT_THROW_MES(expr, message)
bool parse_and_validate_block_from_blob(const blobdata &b_blob, block &b, crypto::hash &block_hash)
std::vector< crypto::hash > tx_hashes
crypto::public_key get_tx_pub_key_from_extra(const transaction &tx, size_t pk_index)
#define ASSERT_MES_AND_THROW(message)
size_t size() const noexcept
bool check_outs_valid(const transaction &tx)
crypto::hash get_transaction_prefix_hash(const transaction_prefix &tx)
crypto::hash get_blob_hash(const epee::span< const char > &blob)
virtual bool sc_secret_add(crypto::secret_key &r, const crypto::secret_key &a, const crypto::secret_key &b)=0
void get_blob_hash(const epee::span< const char > &blob, crypto::hash &res)
void set_blob_size(size_t sz)
#define CRYPTONOTE_DISPLAY_DECIMAL_POINT
uint64_t get_outs_etn_amount(const transaction &tx)
std::string print_etn(uint64_t amount, unsigned int decimal_point)
#define CHECK_AND_ASSERT_MES(expr, fail_ret_val, message)
bool check_stream_state(Archive &ar, bool noeof=false)
size_t get_object_blobsize(const t_object &o)
bool is_blob_size_valid() const
void sc_sub(unsigned char *, const unsigned char *, const unsigned char *)
#define CHECK_AND_NO_ASSERT_MES(expr, fail_ret_val, message)
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_tx_pub_key_to_extra(std::vector< uint8_t > &tx_extra, const crypto::public_key &tx_pub_key)
bool is_v1_tx(const blobdata &tx_blob)
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)
uint64_t get_transaction_weight(const transaction &tx)
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)
bool expand_transaction_1(transaction &tx, bool base_only)
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)
struct hash_func hashes[]
bool calculate_transaction_hash(const transaction &t, crypto::hash &res, size_t *blob_size)
void copy(key &AA, const key &A)
virtual bool generate_key_derivation(const crypto::public_key &pub, const crypto::secret_key &sec, crypto::key_derivation &derivation)=0
std::vector< uint8_t > extra
Archiver & operator &(Archiver &ar, Student &s)
std::vector< tx_out > vout
constexpr std::size_t size() const noexcept
Holds cryptonote related classes and helpers.
const crypto::secret_key null_skey
bool is_hash_valid() const
uint64_t power_integral(uint64_t a, uint64_t b)
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_)
std::vector< txin_v > vin
crypto::public_key m_spend_public_key
bool is_valid_decomposed_amount(uint64_t amount)
bool calculate_transaction_prunable_hash(const transaction &t, const cryptonote::blobdata *blob, crypto::hash &res)
unsigned int get_default_decimal_point()
void set_blob_size_valid(bool v) const
virtual bool derive_public_key(const crypto::key_derivation &derivation, const std::size_t output_index, const crypto::public_key &pub, crypto::public_key &derived_pub)=0
const crypto::public_key null_pkey
rct::rctSig rct_signatures
void cn_fast_hash(const void *data, size_t length, char *hash)
crypto::hash get_block_longhash(const block &b, uint64_t height)
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)
void set_hash_valid(bool v) const
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)
unsigned __int64 uint64_t
virtual bool derive_subaddress_public_key(const crypto::public_key &pub, const crypto::key_derivation &derivation, const std::size_t output_index, crypto::public_key &derived_pub)=0
bool t_serializable_object_to_blob(const t_object &to, blobdata &b_blob)
virtual bool generate_key_image(const crypto::public_key &pub, const crypto::secret_key &sec, crypto::key_image &image)=0
bool get_payment_id_from_tx_extra_nonce(const blobdata &extra_nonce, crypto::hash &payment_id)
bool serialize_rctsig_base(Archive< W > &ar, size_t inputs, size_t outputs)
bool parse_and_validate_tx_base_from_blob(const blobdata &tx_blob, transaction &tx)
crypto::hash get_pruned_transaction_hash(const transaction &t, const crypto::hash &pruned_data_hash)
version
Supported socks variants.
void set_default_decimal_point(unsigned int decimal_point)
void do_serialize(boost::mpl::false_, Archive &a, epee::net_utils::network_address &na)
void cn_fast_hash(const void *data, size_t length, char *hash)
bool get_encrypted_payment_id_from_tx_extra_nonce(const blobdata &extra_nonce, crypto::hash8 &payment_id)
void tree_hash(const char(*hashes)[HASH_SIZE], size_t count, char *root_hash)
bool tx_to_blob(const transaction &tx, blobdata &b_blob)
bool is_hash_valid() const
crypto::secret_key m_view_secret_key
bool check_inputs_overflow(const transaction &tx)
virtual bool derive_secret_key(const crypto::key_derivation &derivation, const std::size_t output_index, const crypto::secret_key &sec, crypto::secret_key &derived_sec)=0
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
std::atomic< unsigned int > prefix_size
bool get_transaction_hash(const transaction &t, crypto::hash &res, size_t &blob_size)
account_public_address m_account_address
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)
bool 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)
#define CHECK_AND_NO_ASSERT_MES_L1(expr, fail_ret_val, message)
bool sort_tx_extra(const std::vector< uint8_t > &tx_extra, std::vector< uint8_t > &sorted_tx_extra, bool allow_partial)
void * memcpy(void *a, const void *b, size_t c)
crypto::secret_key m_spend_secret_key
bool serialize_rctsig_prunable(Archive< W > &ar, uint8_t type, size_t inputs, size_t outputs, size_t mixin)
virtual bool compute_key_image(const cryptonote::account_keys &ack, const crypto::public_key &out_key, const crypto::key_derivation &recv_derivation, size_t real_output_index, const cryptonote::subaddress_index &received_index, cryptonote::keypair &in_ephemeral, crypto::key_image &ki)
bool remove_field_from_tx_extra(std::vector< uint8_t > &tx_extra, const std::type_info &type)
bool check_key(const public_key &key)
bool add_extra_nonce_to_tx_extra(std::vector< uint8_t > &tx_extra, const blobdata &extra_nonce)
void set_hash_valid(bool v) const
bool check_etn_overflow(const transaction &tx)
std::vector< crypto::public_key > get_additional_tx_pub_keys_from_extra(const transaction_prefix &tx)
std::vector< crypto::secret_key > m_multisig_keys
bool get_inputs_etn_amount(const transaction &tx, uint64_t &etn)
virtual crypto::secret_key get_subaddress_secret_key(const crypto::secret_key &sec, const cryptonote::subaddress_index &index)=0
crypto::hash get_block_hash(uint64_t height)
crypto::secret_key decrypt_key(crypto::secret_key key, const epee::wipeable_string &passphrase)
int ge_frombytes_vartime(ge_p3 *, const unsigned char *)
uint64_t get_tx_fee(const transaction &tx)
void set_encrypted_payment_id_to_tx_extra_nonce(blobdata &extra_nonce, const crypto::hash8 &payment_id)
crypto::hash get_tx_tree_hash(const block &b)
void cn_slow_hash(const void *data, size_t length, char *hash, int variant, int prehashed, uint64_t height)
std::string to_string(t_connection_type type)
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)
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)
const char * data() const noexcept
void sc_add(unsigned char *, const unsigned char *, const unsigned char *)
bool parse_and_validate_tx_from_blob(const blobdata &tx_blob, transaction &tx, crypto::hash &tx_hash, crypto::hash &tx_prefix_hash)
hw::device & get_device() const
bool calculate_block_hash(const block &b, crypto::hash &res, const blobdata *blob)
bool serialize_noeof(Archive &ar, T &v)
std::atomic< unsigned int > unprunable_size
uint64_t get_block_height(const block &b)
std::string short_hash_str(const crypto::hash &h)
bool block_to_blob(const block &b, blobdata &b_blob)
constexpr pointer data() const noexcept