| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
#pragma once |
| 32 |
|
| 33 |
#include "cryptonote_basic.h" |
| 34 |
#include "crypto/crypto.h" |
| 35 |
#include "crypto/hash.h" |
| 36 |
|
| 37 |
|
| 38 |
namespace cryptonote { |
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
#pragma pack(push, 1) |
| 44 |
struct public_address_outer_blob |
| 45 |
{ |
| 46 |
uint8_t m_ver; |
| 47 |
account_public_address m_address; |
| 48 |
uint8_t check_sum; |
| 49 |
}; |
| 50 |
struct public_integrated_address_outer_blob |
| 51 |
{ |
| 52 |
uint8_t m_ver; |
| 53 |
account_public_address m_address; |
| 54 |
crypto::hash8 payment_id; |
| 55 |
uint8_t check_sum; |
| 56 |
}; |
| 57 |
#pragma pack (pop) |
| 58 |
|
| 59 |
namespace |
| 60 |
{ |
| 61 |
inline std::string return_first_address(const std::string &url, const std::vector<std::string> &addresses, bool dnssec_valid) |
| 62 |
{ |
| 63 |
if (addresses.empty()) |
| 64 |
return {}; |
| 65 |
return addresses[0]; |
| 66 |
} |
| 67 |
} |
| 68 |
|
| 69 |
struct address_parse_info |
| 70 |
{ |
| 71 |
account_public_address address; |
| 72 |
bool is_subaddress; |
| 73 |
bool has_payment_id; |
| 74 |
crypto::hash8 payment_id; |
| 75 |
}; |
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
size_t get_min_block_weight(uint8_t version); |
| 81 |
size_t get_max_tx_size(); |
| 82 |
bool get_block_reward(size_t median_weight, size_t current_block_weight, uint64_t already_generated_coins, uint64_t &reward, uint8_t version); |
| 83 |
uint8_t get_account_address_checksum(const public_address_outer_blob& bl); |
| 84 |
uint8_t get_account_integrated_address_checksum(const public_integrated_address_outer_blob& bl); |
| 85 |
|
| 86 |
std::string get_account_address_as_str( |
| 87 |
network_type nettype |
| 88 |
, bool subaddress |
| 89 |
, const account_public_address& adr |
| 90 |
); |
| 91 |
|
| 92 |
std::string get_account_integrated_address_as_str( |
| 93 |
network_type nettype |
| 94 |
, const account_public_address& adr |
| 95 |
, const crypto::hash8& payment_id |
| 96 |
); |
| 97 |
|
| 98 |
bool get_account_address_from_str( |
| 99 |
address_parse_info& info |
| 100 |
, network_type nettype |
| 101 |
, const std::string& str |
| 102 |
); |
| 103 |
|
| 104 |
bool get_account_address_from_str_or_url( |
| 105 |
address_parse_info& info |
| 106 |
, network_type nettype |
| 107 |
, const std::string& str_or_url |
| 108 |
, std::function<std::string(const std::string&, const std::vector<std::string>&, bool)> dns_confirm = return_first_address |
| 109 |
); |
| 110 |
|
| 111 |
bool is_coinbase(const transaction& tx); |
| 112 |
|
| 113 |
bool operator ==(const cryptonote::transaction& a, const cryptonote::transaction& b); |
| 114 |
bool operator ==(const cryptonote::block& a, const cryptonote::block& b); |
| 115 |
} |
| 116 |
|
| 117 |
bool parse_hash256(const std::string &str_hash, crypto::hash& hash); |
| 118 |
|