49 #undef ELECTRONEUM_DEFAULT_LOG_CATEGORY 50 #define ELECTRONEUM_DEFAULT_LOG_CATEGORY "cn" 92 static_assert(
DIFFICULTY_TARGET%60==0,
"difficulty target must be a multiple of 60");
97 const int target_minutes = target / 60;
101 const uint64_t premine = 1260000000000U;
102 if (median_weight > 0 && already_generated_coins < premine && !(current_block_weight >= 2 * full_reward_zone)) {
115 V9_BLOCK_HEIGHT = 862866;
118 V9_BLOCK_HEIGHT = 707121;
121 V9_BLOCK_HEIGHT = 39000;
124 V9_BLOCK_HEIGHT = 39000;
128 uint8_t halvings = (current_block_height - V9_BLOCK_HEIGHT) / 1051200;
137 base_reward >>= halvings;
143 base_reward = (
ETN_SUPPLY - already_generated_coins) / pow(2, emission_speed_factor);
152 if (median_weight < full_reward_zone) {
153 median_weight = full_reward_zone;
156 if (current_block_weight <= median_weight) {
157 reward = base_reward;
161 if(current_block_weight > 2 * median_weight) {
162 MERROR(
"Block cumulative weight is too big: " << current_block_weight <<
", expected less than " << 2 * median_weight);
166 assert(median_weight < std::numeric_limits<uint32_t>::max());
167 assert(current_block_weight < std::numeric_limits<uint32_t>::max());
172 uint64_t multiplicand = 2 * median_weight - current_block_weight;
173 multiplicand *= current_block_weight;
174 uint64_t product_lo = mul128(base_reward, multiplicand, &product_hi);
178 div128_32(product_hi, product_lo, static_cast<uint32_t>(median_weight), &reward_hi, &reward_lo);
179 div128_32(reward_hi, reward_lo, static_cast<uint32_t>(median_weight), &reward_hi, &reward_lo);
180 assert(0 == reward_hi);
181 assert(reward_lo < base_reward);
189 const unsigned char* pbuf =
reinterpret_cast<const unsigned char*
>(&bl);
199 const unsigned char* pbuf =
reinterpret_cast<const unsigned char*
>(&bl);
234 if(tx.
vin.size() != 1)
263 if (integrated_address_prefix == prefix)
265 info.is_subaddress =
false;
266 info.has_payment_id =
true;
268 else if (address_prefix == prefix)
270 info.is_subaddress =
false;
271 info.has_payment_id =
false;
273 else if (subaddress_prefix == prefix)
275 info.is_subaddress =
true;
276 info.has_payment_id =
false;
279 LOG_PRINT_L1(
"Wrong address prefix: " << prefix <<
", expected " << address_prefix
280 <<
" or " << integrated_address_prefix
281 <<
" or " << subaddress_prefix);
285 if (
info.has_payment_id)
290 LOG_PRINT_L1(
"Account public address keys can't be parsed");
300 LOG_PRINT_L1(
"Account public address keys can't be parsed");
341 info.is_subaddress =
false;
342 info.has_payment_id =
false;
359 return !address_str.empty() &&
379 MERROR(
"invalid hash format: " << str_hash);
#define EMISSION_SPEED_FACTOR_PER_MINUTE_V8
const config_t & get_config(network_type nettype)
bool is_coinbase(const transaction &tx)
#define EMISSION_SPEED_FACTOR_PER_MINUTE
std::string get_account_address_as_str(network_type nettype, bool subaddress, account_public_address const &adr)
uint64_t const CRYPTONOTE_PUBLIC_ADDRESS_BASE58_PREFIX
#define CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V2
size_t get_min_block_weight(uint8_t version)
account_public_address adr
uint8_t get_account_integrated_address_checksum(const public_integrated_address_outer_blob &bl)
bool parse_binary(const std::string &blob, T &v)
#define KV_SERIALIZE(varialble)
#define CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V8
bool get_account_address_from_str_or_url(address_parse_info &info, network_type nettype, const std::string &str_or_url, std::function< std::string(const std::string &, const std::vector< std::string > &, bool)> dns_confirm)
#define END_SERIALIZE()
self-explanatory
Holds cryptonote related classes and helpers.
std::vector< txin_v > vin
#define CRYPTONOTE_MAX_TX_SIZE
#define DIFFICULTY_TARGET_V6
#define CRYPTONOTE_PUBLIC_ADDRESS_TEXTBLOB_VER
std::string get_account_integrated_address_as_str(network_type nettype, account_public_address const &adr, crypto::hash8 const &payment_id)
bool get_block_hash(const block &b, crypto::hash &res)
uint8_t get_account_address_checksum(const public_address_outer_blob &bl)
unsigned __int64 uint64_t
#define BEGIN_SERIALIZE_OBJECT()
begins the environment of the DSL for described the serialization of an object
bool t_serializable_object_to_blob(const t_object &to, blobdata &b_blob)
#define CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V10
account_public_address m_address
version
Supported socks variants.
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
uint64_t const CRYPTONOTE_PUBLIC_SUBADDRESS_BASE58_PREFIX
#define FINAL_SUBSIDY_PER_MINUTE
crypto::hash get_transaction_hash(const transaction &t)
bool check_key(const public_key &key)
bool get_account_address_from_str(address_parse_info &info, network_type nettype, std::string const &str)
#define DIFFICULTY_TARGET
bool parse_hash256(const std::string &str_hash, crypto::hash &hash)
bool get_block_reward(size_t median_weight, size_t current_block_weight, uint64_t already_generated_coins, uint64_t &reward, uint8_t version, uint64_t current_block_height, network_type nettype)
#define END_KV_SERIALIZE_MAP()
#define FIELD(f)
tags the field with the variable name and then serializes it
uint64_t const CRYPTONOTE_PUBLIC_INTEGRATED_ADDRESS_BASE58_PREFIX
#define CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V5
#define BEGIN_KV_SERIALIZE_MAP()
#define CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V1
bool operator==(const cryptonote::block &a, const cryptonote::block &b)