forked from lthn/blockchain
implemented 128 bit coin supply
This commit is contained in:
parent
12e64bf462
commit
534d649466
15 changed files with 65 additions and 62 deletions
|
|
@ -31,9 +31,10 @@ namespace epee
|
|||
{
|
||||
namespace string_tools
|
||||
{
|
||||
inline std::string print_fixed_decimal_point(uint64_t amount, size_t decimal_point)
|
||||
template<typename t_number>
|
||||
inline std::string print_fixed_decimal_point(t_number amount, size_t decimal_point)
|
||||
{
|
||||
std::string s = std::to_string(amount);
|
||||
std::string s = boost::lexical_cast<std::string>(amount);
|
||||
if (s.size() < decimal_point + 1)
|
||||
{
|
||||
s.insert(0, decimal_point + 1 - s.size(), '0');
|
||||
|
|
|
|||
|
|
@ -1029,7 +1029,7 @@ bool blockchain_storage::validate_miner_transaction(const block& b,
|
|||
size_t cumulative_block_size,
|
||||
uint64_t fee,
|
||||
uint64_t& base_reward,
|
||||
uint64_t already_generated_coins) const
|
||||
const boost::multiprecision::uint128_t& already_generated_coins) const
|
||||
{
|
||||
CRITICAL_REGION_LOCAL(m_read_lock);
|
||||
//validate reward
|
||||
|
|
@ -1128,7 +1128,7 @@ bool blockchain_storage::create_block_template(block& b,
|
|||
fill_block_template_func_t custom_fill_block_template_func /* = nullptr */) const
|
||||
{
|
||||
size_t median_size;
|
||||
uint64_t already_generated_coins;
|
||||
boost::multiprecision::uint128_t already_generated_coins;
|
||||
CRITICAL_REGION_BEGIN(m_read_lock);
|
||||
b.major_version = CURRENT_BLOCK_MAJOR_VERSION;
|
||||
b.minor_version = CURRENT_BLOCK_MINOR_VERSION;
|
||||
|
|
@ -2107,7 +2107,7 @@ bool blockchain_storage::get_random_outs_for_amounts(const COMMAND_RPC_GET_RANDO
|
|||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
uint64_t blockchain_storage::total_coins() const
|
||||
boost::multiprecision::uint128_t blockchain_storage::total_coins() const
|
||||
{
|
||||
CRITICAL_REGION_LOCAL(m_read_lock);
|
||||
if (!m_db_blocks.size())
|
||||
|
|
@ -4423,7 +4423,7 @@ bool blockchain_storage::handle_block_to_main_chain(const block& bl, const crypt
|
|||
}
|
||||
|
||||
uint64_t base_reward = 0;
|
||||
uint64_t already_generated_coins = m_db_blocks.size() ? m_db_blocks.back()->already_generated_coins:0;
|
||||
boost::multiprecision::uint128_t already_generated_coins = m_db_blocks.size() ? m_db_blocks.back()->already_generated_coins:0;
|
||||
if (!validate_miner_transaction(bl, cumulative_block_size, fee_summary, base_reward, already_generated_coins))
|
||||
{
|
||||
LOG_PRINT_L0("Block with id: " << id
|
||||
|
|
|
|||
|
|
@ -230,7 +230,7 @@ namespace currency
|
|||
wide_difficulty_type get_next_diff_conditional2(bool pos, const alt_chain_type& alt_chain, uint64_t split_height) const;
|
||||
wide_difficulty_type get_cached_next_difficulty(bool pos) const;
|
||||
|
||||
typedef bool fill_block_template_func_t(block &bl, bool pos, size_t median_size, uint64_t already_generated_coins, size_t &total_size, uint64_t &fee, uint64_t height);
|
||||
typedef bool fill_block_template_func_t(block &bl, bool pos, size_t median_size, const boost::multiprecision::uint128_t& already_generated_coins, size_t &total_size, uint64_t &fee, uint64_t height);
|
||||
bool create_block_template(block& b, const account_public_address& miner_address, const account_public_address& stakeholder_address, wide_difficulty_type& di, uint64_t& height, const blobdata& ex_nonce, bool pos, const pos_entry& pe, fill_block_template_func_t custom_fill_block_template_func = nullptr) const;
|
||||
bool create_block_template(block& b, const account_public_address& miner_address, wide_difficulty_type& di, uint64_t& height, const blobdata& ex_nonce) const;
|
||||
|
||||
|
|
@ -270,7 +270,7 @@ namespace currency
|
|||
uint64_t get_seconds_between_last_n_block(size_t n)const;
|
||||
bool has_multisig_output(const crypto::hash& multisig_id) const;
|
||||
bool is_multisig_output_spent(const crypto::hash& multisig_id) const;
|
||||
uint64_t total_coins()const;
|
||||
boost::multiprecision::uint128_t total_coins()const;
|
||||
bool is_pos_allowed()const;
|
||||
uint64_t get_tx_fee_median()const;
|
||||
uint64_t get_tx_expiration_median() const;
|
||||
|
|
@ -280,7 +280,7 @@ namespace currency
|
|||
uint64_t get_last_timestamps_check_window_median() const;
|
||||
uint64_t get_last_n_blocks_timestamps_median(size_t n) const;
|
||||
bool prevalidate_alias_info(const transaction& tx, extra_alias_entry& eae);
|
||||
bool validate_miner_transaction(const block& b, size_t cumulative_block_size, uint64_t fee, uint64_t& base_reward, uint64_t already_generated_coins) const;
|
||||
bool validate_miner_transaction(const block& b, size_t cumulative_block_size, uint64_t fee, uint64_t& base_reward, const boost::multiprecision::uint128_t& already_generated_coins) const;
|
||||
performnce_data& get_performnce_data()const;
|
||||
bool validate_instance(const std::string& path);
|
||||
bool is_tx_expired(const transaction& tx) const;
|
||||
|
|
|
|||
|
|
@ -48,13 +48,13 @@ namespace currency
|
|||
wide_difficulty_type cumulative_diff_adjusted;
|
||||
wide_difficulty_type cumulative_diff_precise;
|
||||
wide_difficulty_type difficulty;
|
||||
uint64_t already_generated_coins;
|
||||
boost::multiprecision::uint128_t already_generated_coins;
|
||||
crypto::hash stake_hash; //TODO: unused field for PoW blocks, subject for refactoring
|
||||
uint32_t version;
|
||||
uint64_t this_block_tx_fee_median; //tx fee median for current block transactions
|
||||
uint64_t effective_tx_fee_median; //current fee median which applied for current block's alias registrations
|
||||
|
||||
DEFINE_SERIALIZATION_VERSION(2);
|
||||
DEFINE_SERIALIZATION_VERSION(1);
|
||||
BEGIN_SERIALIZE_OBJECT()
|
||||
VERSION_ENTRY(version)
|
||||
FIELDS(bl)
|
||||
|
|
@ -65,11 +65,8 @@ namespace currency
|
|||
FIELD(difficulty)
|
||||
FIELD(already_generated_coins)
|
||||
FIELD(stake_hash)
|
||||
if (version >= 2)
|
||||
{
|
||||
FIELD(this_block_tx_fee_median)
|
||||
FIELD(effective_tx_fee_median)
|
||||
}
|
||||
FIELD(this_block_tx_fee_median)
|
||||
FIELD(effective_tx_fee_median)
|
||||
END_SERIALIZE()
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ namespace currency
|
|||
|
||||
//---------------------------------------------------------------
|
||||
/*
|
||||
bool construct_miner_tx(size_t height, size_t median_size, uint64_t already_generated_coins,
|
||||
bool construct_miner_tx(size_t height, size_t median_size, const boost::multiprecision::uint128_t& already_generated_coins,
|
||||
size_t current_block_size,
|
||||
uint64_t fee,
|
||||
const account_public_address &miner_address,
|
||||
|
|
@ -76,7 +76,7 @@ namespace currency
|
|||
return diff;
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
bool construct_miner_tx(size_t height, size_t median_size, uint64_t already_generated_coins,
|
||||
bool construct_miner_tx(size_t height, size_t median_size, const boost::multiprecision::uint128_t& already_generated_coins,
|
||||
size_t current_block_size,
|
||||
uint64_t fee,
|
||||
const account_public_address &miner_address,
|
||||
|
|
@ -122,7 +122,7 @@ namespace currency
|
|||
return construct_miner_tx(height, median_size, already_generated_coins, current_block_size, fee, destinations, tx, extra_nonce, max_outs, pos, pe);
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
bool construct_miner_tx(size_t height, size_t median_size, uint64_t already_generated_coins,
|
||||
bool construct_miner_tx(size_t height, size_t median_size, const boost::multiprecision::uint128_t& already_generated_coins,
|
||||
size_t current_block_size,
|
||||
uint64_t fee,
|
||||
const std::vector<tx_destination_entry>& destinations,
|
||||
|
|
@ -1604,15 +1604,7 @@ namespace currency
|
|||
}
|
||||
|
||||
|
||||
std::string print_fixed_decimal_point(uint64_t amount, size_t decimal_point)
|
||||
{
|
||||
return epee::string_tools::print_fixed_decimal_point(amount, decimal_point);
|
||||
}
|
||||
//---------------------------------------------------------------
|
||||
std::string print_money(uint64_t amount)
|
||||
{
|
||||
return print_fixed_decimal_point(amount, CURRENCY_DISPLAY_DECIMAL_POINT);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
std::string print_money_brief(uint64_t amount)
|
||||
{
|
||||
|
|
@ -1713,10 +1705,10 @@ namespace currency
|
|||
std::cout << std::endl << "Reward change for 10 years:" << std::endl;
|
||||
std::cout << std::setw(10) << std::left << "day" << std::setw(19) << "block reward" << std::setw(19) << "generated coins" << std::endl;
|
||||
|
||||
uint64_t already_generated_coins = PREMINE_AMOUNT;
|
||||
uint64_t money_was_at_begining_of_year = already_generated_coins;
|
||||
uint64_t total_generated_in_year_by_pos = 0;
|
||||
uint64_t total_generated_in_year_by_pow = 0;
|
||||
boost::multiprecision::uint128_t already_generated_coins = PREMINE_AMOUNT;
|
||||
boost::multiprecision::uint128_t money_was_at_begining_of_year = already_generated_coins;
|
||||
boost::multiprecision::uint128_t total_generated_in_year_by_pos = 0;
|
||||
boost::multiprecision::uint128_t total_generated_in_year_by_pow = 0;
|
||||
//uint64_t total_money_supply = TOTAL_MONEY_SUPPLY;
|
||||
uint64_t h = 0;
|
||||
for (uint64_t day = 0; day != 365 * 10; ++day)
|
||||
|
|
@ -1730,8 +1722,8 @@ namespace currency
|
|||
<< std::setw(10) << day
|
||||
<< std::setw(19) << print_money(emission_reward)
|
||||
<< std::setw(4) << print_money(already_generated_coins)
|
||||
<< "(POS: " << std::to_string(GET_PERECENTS_BIG_NUMBERS(total_generated_in_year_by_pos, money_was_at_begining_of_year)) << "%"
|
||||
<< ", POW: " << std::to_string(GET_PERECENTS_BIG_NUMBERS(total_generated_in_year_by_pow, money_was_at_begining_of_year)) << "%)"
|
||||
<< "(POS: " << boost::lexical_cast<std::string>(GET_PERECENTS_BIG_NUMBERS(total_generated_in_year_by_pos, money_was_at_begining_of_year)) << "%"
|
||||
<< ", POW: " << boost::lexical_cast<std::string>(GET_PERECENTS_BIG_NUMBERS(total_generated_in_year_by_pow, money_was_at_begining_of_year)) << "%)"
|
||||
|
||||
<< std::setw(19) << ",PoS coins/year: " << print_money(total_generated_in_year_by_pos)
|
||||
<< std::setw(19) << ",PoW coins/year:" << print_money(total_generated_in_year_by_pow)
|
||||
|
|
@ -1765,7 +1757,7 @@ namespace currency
|
|||
// std::cout << std::endl << "Reward change for 20 days:" << std::endl;
|
||||
// std::cout << std::setw(10) << std::left << "day" << std::setw(19) << "block reward" << std::setw(19) << "generated coins" << std::endl;
|
||||
//
|
||||
// uint64_t already_generated_coins = PREMINE_AMOUNT;
|
||||
// const boost::multiprecision::uint128_t& already_generated_coins = PREMINE_AMOUNT;
|
||||
// //uint64_t total_money_supply = TOTAL_MONEY_SUPPLY;
|
||||
// uint64_t h = 0;
|
||||
// for (uint64_t day = 0; day != 20; ++day)
|
||||
|
|
@ -1798,7 +1790,7 @@ namespace currency
|
|||
ss << std::endl << "Reward change for the first " << n_of_first_blocks << " blocks:" << std::endl;
|
||||
ss << std::setw(10) << std::left << "block #" << std::setw(20) << "block reward" << std::setw(20) << "generated coins" << std::setw(8) << "type" << std::endl;
|
||||
|
||||
uint64_t already_generated_coins = 0;
|
||||
boost::multiprecision::uint128_t already_generated_coins = 0;
|
||||
uint64_t total_generated_pos = 0;
|
||||
uint64_t total_generated_pow = 0;
|
||||
|
||||
|
|
@ -2296,7 +2288,7 @@ namespace currency
|
|||
pei_rpc.prev_id = epee::string_tools::pod_to_hex(bei_chain.bl.prev_id);
|
||||
pei_rpc.actual_timestamp = get_actual_timestamp(bei_chain.bl);
|
||||
pei_rpc.type = is_pos_block(bei_chain.bl) ? 0 : 1;
|
||||
pei_rpc.already_generated_coins = bei_chain.already_generated_coins;
|
||||
pei_rpc.already_generated_coins = boost::lexical_cast<std::string>(bei_chain.already_generated_coins);
|
||||
pei_rpc.this_block_fee_median = bei_chain.this_block_tx_fee_median;
|
||||
pei_rpc.effective_fee_median = bei_chain.effective_tx_fee_median;
|
||||
pei_rpc.height = bei_chain.height;
|
||||
|
|
@ -2380,7 +2372,7 @@ namespace currency
|
|||
return CURRENCY_MAX_TRANSACTION_BLOB_SIZE;
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
uint64_t get_base_block_reward(bool is_pos, uint64_t already_generated_coins, uint64_t height)
|
||||
uint64_t get_base_block_reward(bool is_pos, const boost::multiprecision::uint128_t& already_generated_coins, uint64_t height)
|
||||
{
|
||||
if (!height)
|
||||
return PREMINE_AMOUNT;
|
||||
|
|
@ -2388,7 +2380,7 @@ namespace currency
|
|||
return CURRENCY_TESTNET_CONST_REWARD;
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
bool get_block_reward(bool is_pos, size_t median_size, size_t current_block_size, uint64_t already_generated_coins, uint64_t &reward, uint64_t height)
|
||||
bool get_block_reward(bool is_pos, size_t median_size, size_t current_block_size, const boost::multiprecision::uint128_t& already_generated_coins, uint64_t &reward, uint64_t height)
|
||||
{
|
||||
uint64_t base_reward = get_base_block_reward(is_pos, already_generated_coins, height);
|
||||
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ namespace currency
|
|||
|
||||
|
||||
//---------------------------------------------------------------
|
||||
bool construct_miner_tx(size_t height, size_t median_size, uint64_t already_generated_coins,
|
||||
bool construct_miner_tx(size_t height, size_t median_size, const boost::multiprecision::uint128_t& already_generated_coins,
|
||||
size_t current_block_size,
|
||||
uint64_t fee,
|
||||
const account_public_address &miner_address,
|
||||
|
|
@ -174,7 +174,7 @@ namespace currency
|
|||
bool pos = false,
|
||||
const pos_entry& pe = pos_entry());
|
||||
|
||||
bool construct_miner_tx(size_t height, size_t median_size, uint64_t already_generated_coins,
|
||||
bool construct_miner_tx(size_t height, size_t median_size, const boost::multiprecision::uint128_t& already_generated_coins,
|
||||
size_t current_block_size,
|
||||
uint64_t fee,
|
||||
const std::vector<tx_destination_entry>& destinations,
|
||||
|
|
@ -309,9 +309,7 @@ namespace currency
|
|||
uint64_t get_block_height(const block& b);
|
||||
std::vector<txout_v> relative_output_offsets_to_absolute(const std::vector<txout_v>& off);
|
||||
std::vector<txout_v> absolute_output_offsets_to_relative(const std::vector<txout_v>& off);
|
||||
// prints amount in format "3.14000000", "0.00000000"
|
||||
std::string print_money(uint64_t amount);
|
||||
std::string print_fixed_decimal_point(uint64_t amount, size_t decimal_point);
|
||||
|
||||
// prints amount in format "3.14", "0.0"
|
||||
std::string print_money_brief(uint64_t amount);
|
||||
uint64_t get_actual_timestamp(const block& b);
|
||||
|
|
@ -382,8 +380,8 @@ namespace currency
|
|||
/************************************************************************/
|
||||
size_t get_max_block_size();
|
||||
size_t get_max_tx_size();
|
||||
bool get_block_reward(bool is_pos, size_t median_size, size_t current_block_size, uint64_t already_generated_coins, uint64_t &reward, uint64_t height);
|
||||
uint64_t get_base_block_reward(bool is_pos, uint64_t already_generated_coins, uint64_t height);
|
||||
bool get_block_reward(bool is_pos, size_t median_size, size_t current_block_size, const boost::multiprecision::uint128_t& already_generated_coins, uint64_t &reward, uint64_t height);
|
||||
uint64_t get_base_block_reward(bool is_pos, const boost::multiprecision::uint128_t& already_generated_coins, uint64_t height);
|
||||
bool is_payment_id_size_ok(const std::string& payment_id);
|
||||
std::string get_account_address_as_str(const account_public_address& addr);
|
||||
std::string get_account_address_and_payment_id_as_str(const account_public_address& addr, const std::string& payment_id);
|
||||
|
|
@ -440,7 +438,7 @@ namespace currency
|
|||
{
|
||||
return alias_info_to_rpc_alias_info(ai.m_alias, ai, ari);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
template<class alias_rpc_details_t>
|
||||
bool alias_info_to_rpc_alias_info(const std::string& alias, const currency::extra_alias_entry_base& aib, alias_rpc_details_t& ari)
|
||||
{
|
||||
|
|
@ -452,7 +450,19 @@ namespace currency
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
template<typename t_number>
|
||||
std::string print_fixed_decimal_point(t_number amount, size_t decimal_point)
|
||||
{
|
||||
return epee::string_tools::print_fixed_decimal_point(amount, decimal_point);
|
||||
}
|
||||
//---------------------------------------------------------------
|
||||
template<typename t_number>
|
||||
std::string print_money(t_number amount)
|
||||
{
|
||||
return print_fixed_decimal_point(amount, CURRENCY_DISPLAY_DECIMAL_POINT);
|
||||
}
|
||||
//---------------------------------------------------------------
|
||||
template<class alias_rpc_details_t>
|
||||
bool alias_rpc_details_to_alias_info(const alias_rpc_details_t& ard, currency::extra_alias_entry& ai)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1046,7 +1046,7 @@ namespace currency
|
|||
bool tx_memory_pool::fill_block_template(block &bl,
|
||||
bool pos,
|
||||
size_t median_size,
|
||||
uint64_t already_generated_coins,
|
||||
const boost::multiprecision::uint128_t& already_generated_coins,
|
||||
size_t &total_size,
|
||||
uint64_t &fee,
|
||||
uint64_t height)
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ namespace currency
|
|||
// load/store operations
|
||||
bool init(const std::string& config_folder);
|
||||
bool deinit();
|
||||
bool fill_block_template(block &bl, bool pos, size_t median_size, uint64_t already_generated_coins, size_t &total_size, uint64_t &fee, uint64_t height);
|
||||
bool fill_block_template(block &bl, bool pos, size_t median_size, const boost::multiprecision::uint128_t& already_generated_coins, size_t &total_size, uint64_t &fee, uint64_t height);
|
||||
bool get_transactions(std::list<transaction>& txs) const;
|
||||
bool get_all_transactions_details(std::list<tx_rpc_extended_info>& txs)const;
|
||||
bool get_all_transactions_brief_details(std::list<tx_rpc_brief_info>& txs)const;
|
||||
|
|
|
|||
|
|
@ -131,8 +131,12 @@ namespace currency
|
|||
if (pow_bl_ptr)
|
||||
res.last_pow_timestamp = pow_bl_ptr->bl.timestamp;
|
||||
}
|
||||
boost::multiprecision::uint128_t total_coins = 0;
|
||||
if (req.flags&COMMAND_RPC_GET_INFO_FLAG_TOTAL_COINS)
|
||||
res.total_coins = m_core.get_blockchain_storage().total_coins();
|
||||
{
|
||||
total_coins = m_core.get_blockchain_storage().total_coins();
|
||||
res.total_coins = boost::lexical_cast<std::string>(total_coins);
|
||||
}
|
||||
if (req.flags&COMMAND_RPC_GET_INFO_FLAG_LAST_BLOCK_SIZE)
|
||||
{
|
||||
std::vector<size_t> sz;
|
||||
|
|
@ -151,11 +155,11 @@ namespace currency
|
|||
res.pow_sequence_factor = m_core.get_blockchain_storage().get_current_sequence_factor(false);
|
||||
if (req.flags&(COMMAND_RPC_GET_INFO_FLAG_POS_DIFFICULTY | COMMAND_RPC_GET_INFO_FLAG_TOTAL_COINS))
|
||||
{
|
||||
res.block_reward = currency::get_base_block_reward(true, res.total_coins, res.height);
|
||||
res.block_reward = currency::get_base_block_reward(true, total_coins, res.height);
|
||||
currency::block b = AUTO_VAL_INIT(b);
|
||||
m_core.get_blockchain_storage().get_top_block(b);
|
||||
res.last_block_total_reward = currency::get_reward_from_miner_tx(b.miner_tx);
|
||||
res.pos_diff_total_coins_rate = (pos_diff / (res.total_coins - PREMINE_AMOUNT + 1)).convert_to<uint64_t>();
|
||||
res.pos_diff_total_coins_rate = (pos_diff / (total_coins - PREMINE_AMOUNT + 1)).convert_to<uint64_t>();
|
||||
res.last_block_timestamp = b.timestamp;
|
||||
res.last_block_hash = string_tools::pod_to_hex(get_block_hash(b));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -645,7 +645,7 @@ namespace currency
|
|||
uint64_t pow_sequence_factor;
|
||||
uint64_t last_pow_timestamp;
|
||||
uint64_t last_pos_timestamp;
|
||||
uint64_t total_coins;
|
||||
std::string total_coins;
|
||||
uint64_t block_reward;
|
||||
uint64_t last_block_total_reward;
|
||||
uint64_t pos_diff_total_coins_rate;
|
||||
|
|
@ -1234,7 +1234,7 @@ namespace currency
|
|||
std::string pow_seed;
|
||||
uint64_t type;
|
||||
bool is_orphan;
|
||||
uint64_t already_generated_coins;
|
||||
std::string already_generated_coins;
|
||||
uint64_t this_block_fee_median;
|
||||
uint64_t effective_fee_median;
|
||||
std::list<tx_rpc_extended_info> transactions_details;
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ bool block_template_against_txs_size::generate(std::vector<test_event_entry>& ev
|
|||
|
||||
static size_t g_block_txs_total_size = 0;
|
||||
static uint64_t g_block_txs_fee = 0;
|
||||
bool custom_fill_block_template_func(block &bl, bool pos, size_t median_size, uint64_t already_generated_coins, size_t &total_size, uint64_t &fee, uint64_t height)
|
||||
bool custom_fill_block_template_func(block &bl, bool pos, size_t median_size, const boost::multiprecision::uint128_t& already_generated_coins, size_t &total_size, uint64_t &fee, uint64_t height)
|
||||
{
|
||||
total_size = g_block_txs_total_size;
|
||||
fee = g_block_txs_fee;
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ gen_chain_switch_pow_pos::gen_chain_switch_pow_pos()
|
|||
|
||||
bool gen_chain_switch_pow_pos::generate(std::vector<test_event_entry>& events) const
|
||||
{
|
||||
return false; // TODO: for test check only, remove pls
|
||||
uint64_t ts_start = 1420000000;
|
||||
std::list<currency::account_base> miner_stake_sources, alice_stake_sources, bob_stake_sources;
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ inline bool mine_next_pow_block_in_playtime_with_given_txs(const currency::accou
|
|||
{
|
||||
struct loc_helper
|
||||
{
|
||||
static bool fill_block_template_func(currency::block &bl, bool pos, size_t median_size, uint64_t already_generated_coins, size_t &total_size, uint64_t &fee, uint64_t height)
|
||||
static bool fill_block_template_func(currency::block &bl, bool pos, size_t median_size, const boost::multiprecision::uint128_t& already_generated_coins, size_t &total_size, uint64_t &fee, uint64_t height)
|
||||
{
|
||||
fee = 0;
|
||||
total_size = 0;
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ void pos_block_builder::step3_build_stake_kernel(
|
|||
}
|
||||
|
||||
void pos_block_builder::step4_generate_coinbase_tx(size_t median_size,
|
||||
uint64_t already_generated_coins,
|
||||
const boost::multiprecision::uint128_t& already_generated_coins,
|
||||
const account_public_address &reward_receiver_address,
|
||||
const blobdata& extra_nonce,
|
||||
size_t max_outs,
|
||||
|
|
@ -165,7 +165,7 @@ void pos_block_builder::step5_sign(const crypto::public_key& stake_tx_pub_key, s
|
|||
m_step = 5;
|
||||
}
|
||||
|
||||
bool construct_homemade_pos_miner_tx(size_t height, size_t median_size, uint64_t already_generated_coins,
|
||||
bool construct_homemade_pos_miner_tx(size_t height, size_t median_size, const boost::multiprecision::uint128_t& already_generated_coins,
|
||||
size_t current_block_size,
|
||||
uint64_t fee,
|
||||
uint64_t pos_stake_amount,
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ struct pos_block_builder
|
|||
uint64_t timestamp_step = POS_SCAN_STEP);
|
||||
|
||||
void step4_generate_coinbase_tx(size_t median_size,
|
||||
uint64_t already_generated_coins,
|
||||
const boost::multiprecision::uint128_t& already_generated_coins,
|
||||
const currency::account_public_address &reward_receiver_address,
|
||||
const currency::blobdata& extra_nonce = currency::blobdata(),
|
||||
size_t max_outs = CURRENCY_MINER_TX_MAX_OUTS,
|
||||
|
|
@ -44,7 +44,7 @@ struct pos_block_builder
|
|||
uint64_t m_pos_stake_amount;
|
||||
};
|
||||
|
||||
bool construct_homemade_pos_miner_tx(size_t height, size_t median_size, uint64_t already_generated_coins,
|
||||
bool construct_homemade_pos_miner_tx(size_t height, size_t median_size, const boost::multiprecision::uint128_t& already_generated_coins,
|
||||
size_t current_block_size,
|
||||
uint64_t fee,
|
||||
uint64_t pos_stake_amount,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue