Hotfix - add initialization values to extension params, remove trailing spaces
This commit is contained in:
parent
8aaa3791bf
commit
efa7436ded
2 changed files with 67 additions and 52 deletions
|
|
@ -406,7 +406,7 @@ void database::update_active_witnesses()
|
||||||
/// accounts that vote for 0 or 1 witness do not get to express an opinion on
|
/// accounts that vote for 0 or 1 witness do not get to express an opinion on
|
||||||
/// the number of witnesses to have (they abstain and are non-voting accounts)
|
/// the number of witnesses to have (they abstain and are non-voting accounts)
|
||||||
|
|
||||||
share_type stake_tally = 0;
|
share_type stake_tally = 0;
|
||||||
|
|
||||||
size_t witness_count = 0;
|
size_t witness_count = 0;
|
||||||
if( stake_target > 0 )
|
if( stake_target > 0 )
|
||||||
|
|
@ -541,7 +541,7 @@ void database::update_active_committee_members()
|
||||||
update_committee_member_total_votes( cm );
|
update_committee_member_total_votes( cm );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update committee authorities
|
// Update committee authorities
|
||||||
if( !committee_members.empty() )
|
if( !committee_members.empty() )
|
||||||
{
|
{
|
||||||
|
|
@ -679,7 +679,7 @@ void database::update_active_sons()
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Compare current and to-be lists of active sons
|
// Compare current and to-be lists of active sons
|
||||||
auto cur_active_sons = gpo.active_sons;
|
auto cur_active_sons = gpo.active_sons;
|
||||||
|
|
@ -1197,13 +1197,13 @@ double database::calculate_vesting_factor(const account_object& stake_account)
|
||||||
// variables needed
|
// variables needed
|
||||||
const auto number_of_subperiods = vesting_period / vesting_subperiod;
|
const auto number_of_subperiods = vesting_period / vesting_subperiod;
|
||||||
double vesting_factor;
|
double vesting_factor;
|
||||||
|
|
||||||
// get in what sub period we are
|
// get in what sub period we are
|
||||||
uint32_t current_subperiod = get_gpos_current_subperiod();
|
uint32_t current_subperiod = get_gpos_current_subperiod();
|
||||||
|
|
||||||
if(current_subperiod == 0 || current_subperiod > number_of_subperiods) return 0;
|
if(current_subperiod == 0 || current_subperiod > number_of_subperiods) return 0;
|
||||||
|
|
||||||
// On starting new vesting period, all votes become zero until someone votes, To avoid a situation of zero votes,
|
// On starting new vesting period, all votes become zero until someone votes, To avoid a situation of zero votes,
|
||||||
// changes were done to roll in GPOS rules, the vesting factor will be 1 for whoever votes in 6th sub-period of last vesting period
|
// changes were done to roll in GPOS rules, the vesting factor will be 1 for whoever votes in 6th sub-period of last vesting period
|
||||||
// BLOCKBACK-174 fix
|
// BLOCKBACK-174 fix
|
||||||
if(current_subperiod == 1 && this->head_block_time() >= HARDFORK_GPOS_TIME + vesting_period) //Applicable only from 2nd vesting period
|
if(current_subperiod == 1 && this->head_block_time() >= HARDFORK_GPOS_TIME + vesting_period) //Applicable only from 2nd vesting period
|
||||||
|
|
@ -1296,10 +1296,10 @@ void rolling_period_start(database& db)
|
||||||
// dividend-paying asset. This takes any deposits made to the dividend distribution account
|
// dividend-paying asset. This takes any deposits made to the dividend distribution account
|
||||||
// since the last time it was called, and distributes them to the current owners of the
|
// since the last time it was called, and distributes them to the current owners of the
|
||||||
// dividend-paying asset according to the amount they own.
|
// dividend-paying asset according to the amount they own.
|
||||||
void schedule_pending_dividend_balances(database& db,
|
void schedule_pending_dividend_balances(database& db,
|
||||||
const asset_object& dividend_holder_asset_obj,
|
const asset_object& dividend_holder_asset_obj,
|
||||||
const asset_dividend_data_object& dividend_data,
|
const asset_dividend_data_object& dividend_data,
|
||||||
const fc::time_point_sec& current_head_block_time,
|
const fc::time_point_sec& current_head_block_time,
|
||||||
const account_balance_index& balance_index,
|
const account_balance_index& balance_index,
|
||||||
const vesting_balance_index& vesting_index,
|
const vesting_balance_index& vesting_index,
|
||||||
const total_distributed_dividend_balance_object_index& distributed_dividend_balance_index,
|
const total_distributed_dividend_balance_object_index& distributed_dividend_balance_index,
|
||||||
|
|
@ -1308,7 +1308,7 @@ void schedule_pending_dividend_balances(database& db,
|
||||||
dlog("Processing dividend payments for dividend holder asset type ${holder_asset} at time ${t}",
|
dlog("Processing dividend payments for dividend holder asset type ${holder_asset} at time ${t}",
|
||||||
("holder_asset", dividend_holder_asset_obj.symbol)("t", db.head_block_time()));
|
("holder_asset", dividend_holder_asset_obj.symbol)("t", db.head_block_time()));
|
||||||
auto balance_by_acc_index = db.get_index_type< primary_index< account_balance_index > >().get_secondary_index< balances_by_account_index >();
|
auto balance_by_acc_index = db.get_index_type< primary_index< account_balance_index > >().get_secondary_index< balances_by_account_index >();
|
||||||
auto current_distribution_account_balance_range =
|
auto current_distribution_account_balance_range =
|
||||||
//balance_index.indices().get<by_account_asset>().equal_range(boost::make_tuple(dividend_data.dividend_distribution_account));
|
//balance_index.indices().get<by_account_asset>().equal_range(boost::make_tuple(dividend_data.dividend_distribution_account));
|
||||||
balance_by_acc_index.get_account_balances(dividend_data.dividend_distribution_account);
|
balance_by_acc_index.get_account_balances(dividend_data.dividend_distribution_account);
|
||||||
auto previous_distribution_account_balance_range =
|
auto previous_distribution_account_balance_range =
|
||||||
|
|
@ -1319,7 +1319,7 @@ void schedule_pending_dividend_balances(database& db,
|
||||||
const auto& gpo = db.get_global_properties();
|
const auto& gpo = db.get_global_properties();
|
||||||
|
|
||||||
// get the list of accounts that hold nonzero balances of the dividend asset
|
// get the list of accounts that hold nonzero balances of the dividend asset
|
||||||
auto holder_balances_begin =
|
auto holder_balances_begin =
|
||||||
balance_index.indices().get<by_asset_balance>().lower_bound(boost::make_tuple(dividend_holder_asset_obj.id));
|
balance_index.indices().get<by_asset_balance>().lower_bound(boost::make_tuple(dividend_holder_asset_obj.id));
|
||||||
auto holder_balances_end =
|
auto holder_balances_end =
|
||||||
balance_index.indices().get<by_asset_balance>().upper_bound(boost::make_tuple(dividend_holder_asset_obj.id, share_type()));
|
balance_index.indices().get<by_asset_balance>().upper_bound(boost::make_tuple(dividend_holder_asset_obj.id, share_type()));
|
||||||
|
|
@ -1379,7 +1379,7 @@ void schedule_pending_dividend_balances(database& db,
|
||||||
("previous", (int64_t)std::distance(previous_distribution_account_balance_range.first, previous_distribution_account_balance_range.second)));
|
("previous", (int64_t)std::distance(previous_distribution_account_balance_range.first, previous_distribution_account_balance_range.second)));
|
||||||
|
|
||||||
// when we pay out the dividends to the holders, we need to know the total balance of the dividend asset in all
|
// when we pay out the dividends to the holders, we need to know the total balance of the dividend asset in all
|
||||||
// accounts other than the distribution account (it would be silly to distribute dividends back to
|
// accounts other than the distribution account (it would be silly to distribute dividends back to
|
||||||
// the distribution account)
|
// the distribution account)
|
||||||
share_type total_balance_of_dividend_asset;
|
share_type total_balance_of_dividend_asset;
|
||||||
if(db.head_block_time() >= HARDFORK_GPOS_TIME && dividend_holder_asset_obj.symbol == GRAPHENE_SYMBOL) { // only core
|
if(db.head_block_time() >= HARDFORK_GPOS_TIME && dividend_holder_asset_obj.symbol == GRAPHENE_SYMBOL) { // only core
|
||||||
|
|
@ -1410,7 +1410,7 @@ void schedule_pending_dividend_balances(database& db,
|
||||||
share_type previous_balance;
|
share_type previous_balance;
|
||||||
asset_id_type payout_asset_type;
|
asset_id_type payout_asset_type;
|
||||||
|
|
||||||
if (previous_distribution_account_balance_iter == previous_distribution_account_balance_range.second ||
|
if (previous_distribution_account_balance_iter == previous_distribution_account_balance_range.second ||
|
||||||
current_distribution_account_balance_iter->second->asset_type < previous_distribution_account_balance_iter->dividend_payout_asset_type)
|
current_distribution_account_balance_iter->second->asset_type < previous_distribution_account_balance_iter->dividend_payout_asset_type)
|
||||||
{
|
{
|
||||||
// there are no more previous balances or there is no previous balance for this particular asset type
|
// there are no more previous balances or there is no previous balance for this particular asset type
|
||||||
|
|
@ -1418,7 +1418,7 @@ void schedule_pending_dividend_balances(database& db,
|
||||||
current_balance = current_distribution_account_balance_iter->second->balance;
|
current_balance = current_distribution_account_balance_iter->second->balance;
|
||||||
idump((payout_asset_type)(current_balance));
|
idump((payout_asset_type)(current_balance));
|
||||||
}
|
}
|
||||||
else if (current_distribution_account_balance_iter == current_distribution_account_balance_range.end() ||
|
else if (current_distribution_account_balance_iter == current_distribution_account_balance_range.end() ||
|
||||||
previous_distribution_account_balance_iter->dividend_payout_asset_type < current_distribution_account_balance_iter->second->asset_type)
|
previous_distribution_account_balance_iter->dividend_payout_asset_type < current_distribution_account_balance_iter->second->asset_type)
|
||||||
{
|
{
|
||||||
// there are no more current balances or there is no current balance for this particular previous asset type
|
// there are no more current balances or there is no current balance for this particular previous asset type
|
||||||
|
|
@ -1437,7 +1437,7 @@ void schedule_pending_dividend_balances(database& db,
|
||||||
|
|
||||||
share_type delta_balance = current_balance - previous_balance;
|
share_type delta_balance = current_balance - previous_balance;
|
||||||
|
|
||||||
// Next, figure out if we want to share this out -- if the amount added to the distribution
|
// Next, figure out if we want to share this out -- if the amount added to the distribution
|
||||||
// account since last payout is too small, we won't bother.
|
// account since last payout is too small, we won't bother.
|
||||||
|
|
||||||
share_type total_fee_per_asset_in_payout_asset;
|
share_type total_fee_per_asset_in_payout_asset;
|
||||||
|
|
@ -1446,7 +1446,7 @@ void schedule_pending_dividend_balances(database& db,
|
||||||
{
|
{
|
||||||
payout_asset_object = &db.get_core_asset();
|
payout_asset_object = &db.get_core_asset();
|
||||||
total_fee_per_asset_in_payout_asset = total_fee_per_asset_in_core;
|
total_fee_per_asset_in_payout_asset = total_fee_per_asset_in_core;
|
||||||
dlog("Fee for distributing ${payout_asset_type}: ${fee}",
|
dlog("Fee for distributing ${payout_asset_type}: ${fee}",
|
||||||
("payout_asset_type", asset_id_type()(db).symbol)
|
("payout_asset_type", asset_id_type()(db).symbol)
|
||||||
("fee", asset(total_fee_per_asset_in_core, asset_id_type())));
|
("fee", asset(total_fee_per_asset_in_core, asset_id_type())));
|
||||||
}
|
}
|
||||||
|
|
@ -1462,7 +1462,7 @@ void schedule_pending_dividend_balances(database& db,
|
||||||
FC_ASSERT(total_fee_per_asset.asset_id == payout_asset_type);
|
FC_ASSERT(total_fee_per_asset.asset_id == payout_asset_type);
|
||||||
|
|
||||||
total_fee_per_asset_in_payout_asset = total_fee_per_asset.amount;
|
total_fee_per_asset_in_payout_asset = total_fee_per_asset.amount;
|
||||||
dlog("Fee for distributing ${payout_asset_type}: ${fee}",
|
dlog("Fee for distributing ${payout_asset_type}: ${fee}",
|
||||||
("payout_asset_type", payout_asset_type(db).symbol)("fee", total_fee_per_asset_in_payout_asset));
|
("payout_asset_type", payout_asset_type(db).symbol)("fee", total_fee_per_asset_in_payout_asset));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1475,7 +1475,7 @@ void schedule_pending_dividend_balances(database& db,
|
||||||
wdump((total_fee_per_asset_in_payout_asset)(dividend_data.options));
|
wdump((total_fee_per_asset_in_payout_asset)(dividend_data.options));
|
||||||
minimum_shares_to_distribute = minimum_amount_to_distribute.to_uint64();
|
minimum_shares_to_distribute = minimum_amount_to_distribute.to_uint64();
|
||||||
}
|
}
|
||||||
|
|
||||||
dlog("Processing dividend payments of asset type ${payout_asset_type}, delta balance is ${delta_balance}", ("payout_asset_type", payout_asset_type(db).symbol)("delta_balance", delta_balance));
|
dlog("Processing dividend payments of asset type ${payout_asset_type}, delta balance is ${delta_balance}", ("payout_asset_type", payout_asset_type(db).symbol)("delta_balance", delta_balance));
|
||||||
if (delta_balance > 0)
|
if (delta_balance > 0)
|
||||||
{
|
{
|
||||||
|
|
@ -1488,7 +1488,7 @@ void schedule_pending_dividend_balances(database& db,
|
||||||
db.modify(asset_dynamic_data_id_type()(db), [total_fee_per_asset_in_core](asset_dynamic_data_object& d) {
|
db.modify(asset_dynamic_data_id_type()(db), [total_fee_per_asset_in_core](asset_dynamic_data_object& d) {
|
||||||
d.accumulated_fees += total_fee_per_asset_in_core;
|
d.accumulated_fees += total_fee_per_asset_in_core;
|
||||||
});
|
});
|
||||||
db.adjust_balance(dividend_data.dividend_distribution_account,
|
db.adjust_balance(dividend_data.dividend_distribution_account,
|
||||||
asset(-total_fee_per_asset_in_core, asset_id_type()));
|
asset(-total_fee_per_asset_in_core, asset_id_type()));
|
||||||
delta_balance -= total_fee_per_asset_in_core;
|
delta_balance -= total_fee_per_asset_in_core;
|
||||||
}
|
}
|
||||||
|
|
@ -1503,7 +1503,7 @@ void schedule_pending_dividend_balances(database& db,
|
||||||
("need", asset(total_fee_per_asset_in_core, asset_id_type()))
|
("need", asset(total_fee_per_asset_in_core, asset_id_type()))
|
||||||
("have", asset(dynamic_data.fee_pool, payout_asset_type)));
|
("have", asset(dynamic_data.fee_pool, payout_asset_type)));
|
||||||
// deduct the fee from the dividend distribution account
|
// deduct the fee from the dividend distribution account
|
||||||
db.adjust_balance(dividend_data.dividend_distribution_account,
|
db.adjust_balance(dividend_data.dividend_distribution_account,
|
||||||
asset(-total_fee_per_asset_in_payout_asset, payout_asset_type));
|
asset(-total_fee_per_asset_in_payout_asset, payout_asset_type));
|
||||||
// convert it to core
|
// convert it to core
|
||||||
db.modify(payout_asset_object->dynamic_data(db), [total_fee_per_asset_in_core, total_fee_per_asset_in_payout_asset](asset_dynamic_data_object& d) {
|
db.modify(payout_asset_object->dynamic_data(db), [total_fee_per_asset_in_core, total_fee_per_asset_in_payout_asset](asset_dynamic_data_object& d) {
|
||||||
|
|
@ -1517,7 +1517,7 @@ void schedule_pending_dividend_balances(database& db,
|
||||||
delta_balance -= total_fee_per_asset_in_payout_asset;
|
delta_balance -= total_fee_per_asset_in_payout_asset;
|
||||||
}
|
}
|
||||||
|
|
||||||
dlog("There are ${count} holders of the dividend-paying asset, with a total balance of ${total}",
|
dlog("There are ${count} holders of the dividend-paying asset, with a total balance of ${total}",
|
||||||
("count", holder_account_count)
|
("count", holder_account_count)
|
||||||
("total", total_balance_of_dividend_asset));
|
("total", total_balance_of_dividend_asset));
|
||||||
share_type remaining_amount_to_distribute = delta_balance;
|
share_type remaining_amount_to_distribute = delta_balance;
|
||||||
|
|
@ -1589,7 +1589,7 @@ void schedule_pending_dividend_balances(database& db,
|
||||||
dlog("Pending payout: ${account_name} -> ${amount}",
|
dlog("Pending payout: ${account_name} -> ${amount}",
|
||||||
("account_name", pending_payout.owner(db).name)
|
("account_name", pending_payout.owner(db).name)
|
||||||
("amount", asset(pending_payout.pending_balance, pending_payout.dividend_payout_asset_type)));
|
("amount", asset(pending_payout.pending_balance, pending_payout.dividend_payout_asset_type)));
|
||||||
dlog("Remaining balance not paid out: ${amount}",
|
dlog("Remaining balance not paid out: ${amount}",
|
||||||
("amount", asset(remaining_amount_to_distribute, payout_asset_type)));
|
("amount", asset(remaining_amount_to_distribute, payout_asset_type)));
|
||||||
|
|
||||||
share_type distributed_amount = delta_balance - remaining_amount_to_distribute;
|
share_type distributed_amount = delta_balance - remaining_amount_to_distribute;
|
||||||
|
|
@ -1619,7 +1619,7 @@ void schedule_pending_dividend_balances(database& db,
|
||||||
// This should be extremely rare (caused by an override transfer by the asset owner).
|
// This should be extremely rare (caused by an override transfer by the asset owner).
|
||||||
// Reduce all pending payouts proportionally
|
// Reduce all pending payouts proportionally
|
||||||
share_type total_pending_balances;
|
share_type total_pending_balances;
|
||||||
auto pending_payouts_range =
|
auto pending_payouts_range =
|
||||||
pending_payout_balance_index.indices().get<by_dividend_payout_account>().equal_range(boost::make_tuple(dividend_holder_asset_obj.id, payout_asset_type));
|
pending_payout_balance_index.indices().get<by_dividend_payout_account>().equal_range(boost::make_tuple(dividend_holder_asset_obj.id, payout_asset_type));
|
||||||
|
|
||||||
for (const pending_dividend_payout_balance_for_holder_object& pending_balance_object : boost::make_iterator_range(pending_payouts_range.first, pending_payouts_range.second))
|
for (const pending_dividend_payout_balance_for_holder_object& pending_balance_object : boost::make_iterator_range(pending_payouts_range.first, pending_payouts_range.second))
|
||||||
|
|
@ -1656,10 +1656,10 @@ void schedule_pending_dividend_balances(database& db,
|
||||||
}
|
}
|
||||||
|
|
||||||
// iterate
|
// iterate
|
||||||
if (previous_distribution_account_balance_iter == previous_distribution_account_balance_range.second ||
|
if (previous_distribution_account_balance_iter == previous_distribution_account_balance_range.second ||
|
||||||
current_distribution_account_balance_iter->second->asset_type < previous_distribution_account_balance_iter->dividend_payout_asset_type)
|
current_distribution_account_balance_iter->second->asset_type < previous_distribution_account_balance_iter->dividend_payout_asset_type)
|
||||||
++current_distribution_account_balance_iter;
|
++current_distribution_account_balance_iter;
|
||||||
else if (current_distribution_account_balance_iter == current_distribution_account_balance_range.end() ||
|
else if (current_distribution_account_balance_iter == current_distribution_account_balance_range.end() ||
|
||||||
previous_distribution_account_balance_iter->dividend_payout_asset_type < current_distribution_account_balance_iter->second->asset_type)
|
previous_distribution_account_balance_iter->dividend_payout_asset_type < current_distribution_account_balance_iter->second->asset_type)
|
||||||
++previous_distribution_account_balance_iter;
|
++previous_distribution_account_balance_iter;
|
||||||
else
|
else
|
||||||
|
|
@ -1701,7 +1701,7 @@ void process_dividend_assets(database& db)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
dlog("Dividend payout time has arrived for asset ${holder_asset}",
|
dlog("Dividend payout time has arrived for asset ${holder_asset}",
|
||||||
("holder_asset", dividend_holder_asset_obj.symbol));
|
("holder_asset", dividend_holder_asset_obj.symbol));
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
// dump balances before the payouts for debugging
|
// dump balances before the payouts for debugging
|
||||||
|
|
@ -1713,14 +1713,14 @@ void process_dividend_assets(database& db)
|
||||||
|
|
||||||
// when we do the payouts, we first increase the balances in all of the receiving accounts
|
// when we do the payouts, we first increase the balances in all of the receiving accounts
|
||||||
// and use this map to keep track of the total amount of each asset paid out.
|
// and use this map to keep track of the total amount of each asset paid out.
|
||||||
// Afterwards, we decrease the distribution account's balance by the total amount paid out,
|
// Afterwards, we decrease the distribution account's balance by the total amount paid out,
|
||||||
// and modify the distributed_balances accordingly
|
// and modify the distributed_balances accordingly
|
||||||
std::map<asset_id_type, share_type> amounts_paid_out_by_asset;
|
std::map<asset_id_type, share_type> amounts_paid_out_by_asset;
|
||||||
|
|
||||||
auto pending_payouts_range =
|
auto pending_payouts_range =
|
||||||
pending_payout_balance_index.indices().get<by_dividend_account_payout>().equal_range(boost::make_tuple(dividend_holder_asset_obj.id));
|
pending_payout_balance_index.indices().get<by_dividend_account_payout>().equal_range(boost::make_tuple(dividend_holder_asset_obj.id));
|
||||||
// the pending_payouts_range is all payouts for this dividend asset, sorted by the holder's account
|
// the pending_payouts_range is all payouts for this dividend asset, sorted by the holder's account
|
||||||
// we iterate in this order so we can build up a list of payouts for each account to put in the
|
// we iterate in this order so we can build up a list of payouts for each account to put in the
|
||||||
// virtual op
|
// virtual op
|
||||||
vector<asset> payouts_for_this_holder;
|
vector<asset> payouts_for_this_holder;
|
||||||
fc::optional<account_id_type> last_holder_account_id;
|
fc::optional<account_id_type> last_holder_account_id;
|
||||||
|
|
@ -1732,7 +1732,7 @@ void process_dividend_assets(database& db)
|
||||||
auto approved_assets_iter = approved_assets.find(asset_id);
|
auto approved_assets_iter = approved_assets.find(asset_id);
|
||||||
if (approved_assets_iter != approved_assets.end())
|
if (approved_assets_iter != approved_assets.end())
|
||||||
return approved_assets_iter->second;
|
return approved_assets_iter->second;
|
||||||
bool is_approved = is_authorized_asset(db, dividend_distribution_account_object,
|
bool is_approved = is_authorized_asset(db, dividend_distribution_account_object,
|
||||||
asset_id(db));
|
asset_id(db));
|
||||||
approved_assets[asset_id] = is_approved;
|
approved_assets[asset_id] = is_approved;
|
||||||
return is_approved;
|
return is_approved;
|
||||||
|
|
@ -1745,8 +1745,8 @@ void process_dividend_assets(database& db)
|
||||||
if (last_holder_account_id && *last_holder_account_id != pending_balance_object.owner && payouts_for_this_holder.size())
|
if (last_holder_account_id && *last_holder_account_id != pending_balance_object.owner && payouts_for_this_holder.size())
|
||||||
{
|
{
|
||||||
// we've moved on to a new account, generate the dividend payment virtual op for the previous one
|
// we've moved on to a new account, generate the dividend payment virtual op for the previous one
|
||||||
db.push_applied_operation(asset_dividend_distribution_operation(dividend_holder_asset_obj.id,
|
db.push_applied_operation(asset_dividend_distribution_operation(dividend_holder_asset_obj.id,
|
||||||
*last_holder_account_id,
|
*last_holder_account_id,
|
||||||
payouts_for_this_holder));
|
payouts_for_this_holder));
|
||||||
dlog("Just pushed virtual op for payout to ${account}", ("account", (*last_holder_account_id)(db).name));
|
dlog("Just pushed virtual op for payout to ${account}", ("account", (*last_holder_account_id)(db).name));
|
||||||
payouts_for_this_holder.clear();
|
payouts_for_this_holder.clear();
|
||||||
|
|
@ -1758,14 +1758,14 @@ void process_dividend_assets(database& db)
|
||||||
is_authorized_asset(db, pending_balance_object.owner(db), pending_balance_object.dividend_payout_asset_type(db)) &&
|
is_authorized_asset(db, pending_balance_object.owner(db), pending_balance_object.dividend_payout_asset_type(db)) &&
|
||||||
is_asset_approved_for_distribution_account(pending_balance_object.dividend_payout_asset_type))
|
is_asset_approved_for_distribution_account(pending_balance_object.dividend_payout_asset_type))
|
||||||
{
|
{
|
||||||
dlog("Processing payout of ${asset} to account ${account}",
|
dlog("Processing payout of ${asset} to account ${account}",
|
||||||
("asset", asset(pending_balance_object.pending_balance, pending_balance_object.dividend_payout_asset_type))
|
("asset", asset(pending_balance_object.pending_balance, pending_balance_object.dividend_payout_asset_type))
|
||||||
("account", pending_balance_object.owner(db).name));
|
("account", pending_balance_object.owner(db).name));
|
||||||
|
|
||||||
db.adjust_balance(pending_balance_object.owner,
|
db.adjust_balance(pending_balance_object.owner,
|
||||||
asset(pending_balance_object.pending_balance,
|
asset(pending_balance_object.pending_balance,
|
||||||
pending_balance_object.dividend_payout_asset_type));
|
pending_balance_object.dividend_payout_asset_type));
|
||||||
payouts_for_this_holder.push_back(asset(pending_balance_object.pending_balance,
|
payouts_for_this_holder.push_back(asset(pending_balance_object.pending_balance,
|
||||||
pending_balance_object.dividend_payout_asset_type));
|
pending_balance_object.dividend_payout_asset_type));
|
||||||
last_holder_account_id = pending_balance_object.owner;
|
last_holder_account_id = pending_balance_object.owner;
|
||||||
amounts_paid_out_by_asset[pending_balance_object.dividend_payout_asset_type] += pending_balance_object.pending_balance;
|
amounts_paid_out_by_asset[pending_balance_object.dividend_payout_asset_type] += pending_balance_object.pending_balance;
|
||||||
|
|
@ -1781,8 +1781,8 @@ void process_dividend_assets(database& db)
|
||||||
if (last_holder_account_id && payouts_for_this_holder.size())
|
if (last_holder_account_id && payouts_for_this_holder.size())
|
||||||
{
|
{
|
||||||
// we've moved on to a new account, generate the dividend payment virtual op for the previous one
|
// we've moved on to a new account, generate the dividend payment virtual op for the previous one
|
||||||
db.push_applied_operation(asset_dividend_distribution_operation(dividend_holder_asset_obj.id,
|
db.push_applied_operation(asset_dividend_distribution_operation(dividend_holder_asset_obj.id,
|
||||||
*last_holder_account_id,
|
*last_holder_account_id,
|
||||||
payouts_for_this_holder));
|
payouts_for_this_holder));
|
||||||
dlog("Just pushed virtual op for payout to ${account}", ("account", (*last_holder_account_id)(db).name));
|
dlog("Just pushed virtual op for payout to ${account}", ("account", (*last_holder_account_id)(db).name));
|
||||||
}
|
}
|
||||||
|
|
@ -1795,11 +1795,11 @@ void process_dividend_assets(database& db)
|
||||||
const asset_id_type& asset_paid_out = value.first;
|
const asset_id_type& asset_paid_out = value.first;
|
||||||
const share_type& amount_paid_out = value.second;
|
const share_type& amount_paid_out = value.second;
|
||||||
|
|
||||||
db.adjust_balance(dividend_data.dividend_distribution_account,
|
db.adjust_balance(dividend_data.dividend_distribution_account,
|
||||||
asset(-amount_paid_out,
|
asset(-amount_paid_out,
|
||||||
asset_paid_out));
|
asset_paid_out));
|
||||||
auto distributed_balance_iter =
|
auto distributed_balance_iter =
|
||||||
distributed_dividend_balance_index.indices().get<by_dividend_payout_asset>().find(boost::make_tuple(dividend_holder_asset_obj.id,
|
distributed_dividend_balance_index.indices().get<by_dividend_payout_asset>().find(boost::make_tuple(dividend_holder_asset_obj.id,
|
||||||
asset_paid_out));
|
asset_paid_out));
|
||||||
assert(distributed_balance_iter != distributed_dividend_balance_index.indices().get<by_dividend_payout_asset>().end());
|
assert(distributed_balance_iter != distributed_dividend_balance_index.indices().get<by_dividend_payout_asset>().end());
|
||||||
if (distributed_balance_iter != distributed_dividend_balance_index.indices().get<by_dividend_payout_asset>().end())
|
if (distributed_balance_iter != distributed_dividend_balance_index.indices().get<by_dividend_payout_asset>().end())
|
||||||
|
|
@ -1816,7 +1816,7 @@ void process_dividend_assets(database& db)
|
||||||
fc::optional<fc::time_point_sec> next_payout_time;
|
fc::optional<fc::time_point_sec> next_payout_time;
|
||||||
if (dividend_data_obj.options.payout_interval)
|
if (dividend_data_obj.options.payout_interval)
|
||||||
{
|
{
|
||||||
// if there was a previous payout, make our next payment one interval
|
// if there was a previous payout, make our next payment one interval
|
||||||
uint32_t current_time_sec = current_head_block_time.sec_since_epoch();
|
uint32_t current_time_sec = current_head_block_time.sec_since_epoch();
|
||||||
fc::time_point_sec reference_time = *dividend_data_obj.last_scheduled_payout_time;
|
fc::time_point_sec reference_time = *dividend_data_obj.last_scheduled_payout_time;
|
||||||
uint32_t next_possible_time_sec = dividend_data_obj.last_scheduled_payout_time->sec_since_epoch();
|
uint32_t next_possible_time_sec = dividend_data_obj.last_scheduled_payout_time->sec_since_epoch();
|
||||||
|
|
@ -1831,7 +1831,7 @@ void process_dividend_assets(database& db)
|
||||||
(dividend_data_obj.last_payout_time)
|
(dividend_data_obj.last_payout_time)
|
||||||
(dividend_data_obj.options.next_payout_time));
|
(dividend_data_obj.options.next_payout_time));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
FC_RETHROW_EXCEPTIONS(error, "Error while paying out dividends for holder asset ${holder_asset}", ("holder_asset", dividend_holder_asset_obj.symbol))
|
FC_RETHROW_EXCEPTIONS(error, "Error while paying out dividends for holder asset ${holder_asset}", ("holder_asset", dividend_holder_asset_obj.symbol))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2044,7 +2044,7 @@ void database::perform_chain_maintenance(const signed_block& next_block, const g
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} tally_helper(*this, gpo);
|
} tally_helper(*this, gpo);
|
||||||
|
|
||||||
perform_account_maintenance( tally_helper );
|
perform_account_maintenance( tally_helper );
|
||||||
struct clear_canary {
|
struct clear_canary {
|
||||||
clear_canary(vector<uint64_t>& target): target(target){}
|
clear_canary(vector<uint64_t>& target): target(target){}
|
||||||
|
|
@ -2089,7 +2089,21 @@ void database::perform_chain_maintenance(const signed_block& next_block, const g
|
||||||
if( !p.pending_parameters->extensions.value.gpos_subperiod.valid() )
|
if( !p.pending_parameters->extensions.value.gpos_subperiod.valid() )
|
||||||
p.pending_parameters->extensions.value.gpos_subperiod = p.parameters.extensions.value.gpos_subperiod;
|
p.pending_parameters->extensions.value.gpos_subperiod = p.parameters.extensions.value.gpos_subperiod;
|
||||||
if( !p.pending_parameters->extensions.value.gpos_vesting_lockin_period.valid() )
|
if( !p.pending_parameters->extensions.value.gpos_vesting_lockin_period.valid() )
|
||||||
p.pending_parameters->extensions.value.gpos_vesting_lockin_period = p.parameters.extensions.value.gpos_vesting_lockin_period;
|
p.pending_parameters->extensions.value.gpos_vesting_lockin_period = p.parameters.extensions.value.gpos_vesting_lockin_period;
|
||||||
|
if( !p.pending_parameters->extensions.value.son_vesting_amount.valid() )
|
||||||
|
p.pending_parameters->extensions.value.son_vesting_amount = p.parameters.extensions.value.son_vesting_amount;
|
||||||
|
if( !p.pending_parameters->extensions.value.son_vesting_period.valid() )
|
||||||
|
p.pending_parameters->extensions.value.son_vesting_period = p.parameters.extensions.value.son_vesting_period;
|
||||||
|
if( !p.pending_parameters->extensions.value.son_pay_max.valid() )
|
||||||
|
p.pending_parameters->extensions.value.son_pay_max = p.parameters.extensions.value.son_pay_max;
|
||||||
|
if( !p.pending_parameters->extensions.value.son_pay_time.valid() )
|
||||||
|
p.pending_parameters->extensions.value.son_pay_time = p.parameters.extensions.value.son_pay_time;
|
||||||
|
if( !p.pending_parameters->extensions.value.son_deregister_time.valid() )
|
||||||
|
p.pending_parameters->extensions.value.son_deregister_time = p.parameters.extensions.value.son_deregister_time;
|
||||||
|
if( !p.pending_parameters->extensions.value.son_heartbeat_frequency.valid() )
|
||||||
|
p.pending_parameters->extensions.value.son_heartbeat_frequency = p.parameters.extensions.value.son_heartbeat_frequency;
|
||||||
|
if( !p.pending_parameters->extensions.value.son_down_time.valid() )
|
||||||
|
p.pending_parameters->extensions.value.son_down_time = p.parameters.extensions.value.son_down_time;
|
||||||
p.parameters = std::move(*p.pending_parameters);
|
p.parameters = std::move(*p.pending_parameters);
|
||||||
p.pending_parameters.reset();
|
p.pending_parameters.reset();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,13 +50,14 @@ namespace graphene { namespace chain {
|
||||||
optional < uint32_t > gpos_period_start = HARDFORK_GPOS_TIME.sec_since_epoch();
|
optional < uint32_t > gpos_period_start = HARDFORK_GPOS_TIME.sec_since_epoch();
|
||||||
optional < uint32_t > gpos_vesting_lockin_period = GPOS_VESTING_LOCKIN_PERIOD;
|
optional < uint32_t > gpos_vesting_lockin_period = GPOS_VESTING_LOCKIN_PERIOD;
|
||||||
|
|
||||||
optional < uint32_t > son_vesting_amount;
|
optional < uint32_t > son_vesting_amount = SON_VESTING_AMOUNT;
|
||||||
optional < uint32_t > son_vesting_period;
|
optional < uint32_t > son_vesting_period = SON_VESTING_PERIOD;
|
||||||
optional < uint32_t > son_pay_max;
|
optional < uint32_t > son_pay_max = SON_PAY_MAX;
|
||||||
optional < uint32_t > son_pay_time;
|
optional < uint32_t > son_pay_time = SON_PAY_TIME;
|
||||||
optional < uint32_t > son_deregister_time;
|
optional < uint32_t > son_deregister_time = SON_DEREGISTER_TIME;
|
||||||
optional < uint32_t > son_heartbeat_frequency;
|
optional < uint32_t > son_heartbeat_frequency = SON_HEARTBEAT_FREQUENCY;
|
||||||
optional < uint32_t > son_down_time;
|
optional < uint32_t > son_down_time = SON_DOWN_TIME;
|
||||||
|
|
||||||
optional < account_id_type > son_account;
|
optional < account_id_type > son_account;
|
||||||
optional < asset_id_type > btc_asset;
|
optional < asset_id_type > btc_asset;
|
||||||
};
|
};
|
||||||
|
|
@ -109,7 +110,7 @@ namespace graphene { namespace chain {
|
||||||
uint32_t maximum_tournament_start_time_in_future = TOURNAMENT_MAX_START_TIME_IN_FUTURE;
|
uint32_t maximum_tournament_start_time_in_future = TOURNAMENT_MAX_START_TIME_IN_FUTURE;
|
||||||
uint32_t maximum_tournament_start_delay = TOURNAMENT_MAX_START_DELAY;
|
uint32_t maximum_tournament_start_delay = TOURNAMENT_MAX_START_DELAY;
|
||||||
uint16_t maximum_tournament_number_of_wins = TOURNAMENT_MAX_NUMBER_OF_WINS;
|
uint16_t maximum_tournament_number_of_wins = TOURNAMENT_MAX_NUMBER_OF_WINS;
|
||||||
|
|
||||||
extension<parameter_extension> extensions;
|
extension<parameter_extension> extensions;
|
||||||
|
|
||||||
/** defined in fee_schedule.cpp */
|
/** defined in fee_schedule.cpp */
|
||||||
|
|
@ -171,7 +172,7 @@ namespace graphene { namespace chain {
|
||||||
}
|
}
|
||||||
inline uint32_t gpos_vesting_lockin_period()const {
|
inline uint32_t gpos_vesting_lockin_period()const {
|
||||||
return extensions.value.gpos_vesting_lockin_period.valid() ? *extensions.value.gpos_vesting_lockin_period : GPOS_VESTING_LOCKIN_PERIOD; /// GPOS vesting lockin period
|
return extensions.value.gpos_vesting_lockin_period.valid() ? *extensions.value.gpos_vesting_lockin_period : GPOS_VESTING_LOCKIN_PERIOD; /// GPOS vesting lockin period
|
||||||
}
|
}
|
||||||
inline account_id_type son_account() const {
|
inline account_id_type son_account() const {
|
||||||
return extensions.value.son_account.valid() ? *extensions.value.son_account : GRAPHENE_NULL_ACCOUNT;
|
return extensions.value.son_account.valid() ? *extensions.value.son_account : GRAPHENE_NULL_ACCOUNT;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue