hf protection for creating gpos balances in proposals
This commit is contained in:
parent
d468b146e8
commit
83ea345042
2 changed files with 8 additions and 6 deletions
|
|
@ -735,7 +735,7 @@ double calculate_vesting_factor(const database& d, const account_object& stake_a
|
||||||
const auto &gpo = d.get_global_properties();
|
const auto &gpo = d.get_global_properties();
|
||||||
const auto vesting_period = gpo.parameters.gpos_period;
|
const auto vesting_period = gpo.parameters.gpos_period;
|
||||||
const auto vesting_subperiod = gpo.parameters.gpos_subperiod;
|
const auto vesting_subperiod = gpo.parameters.gpos_subperiod;
|
||||||
const auto period_start = time_point_sec(gpo.parameters.gpos_period_start);
|
const auto period_start = gpo.parameters.gpos_period_start;
|
||||||
|
|
||||||
// variables needed
|
// variables needed
|
||||||
const fc::time_point_sec period_end = period_start + vesting_period;
|
const fc::time_point_sec period_end = period_start + vesting_period;
|
||||||
|
|
@ -761,8 +761,6 @@ double calculate_vesting_factor(const database& d, const account_object& stake_a
|
||||||
|
|
||||||
// coefficient calculation is: (n-1)/number_of_subperiods
|
// coefficient calculation is: (n-1)/number_of_subperiods
|
||||||
double n = number_of_subperiods + 1;
|
double n = number_of_subperiods + 1;
|
||||||
if (current_period > number_of_subperiods) // exception maybe?
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
auto period = std::find_if(period_list.begin(), period_list.end(),[&](uint32_t p) {
|
auto period = std::find_if(period_list.begin(), period_list.end(),[&](uint32_t p) {
|
||||||
return (p == current_period);
|
return (p == current_period);
|
||||||
|
|
@ -1393,10 +1391,10 @@ void database::perform_chain_maintenance(const signed_block& next_block, const g
|
||||||
distribute_fba_balances(*this);
|
distribute_fba_balances(*this);
|
||||||
create_buyback_orders(*this);
|
create_buyback_orders(*this);
|
||||||
|
|
||||||
process_dividend_assets(*this);
|
|
||||||
|
|
||||||
rolling_period_start(*this);
|
rolling_period_start(*this);
|
||||||
|
|
||||||
|
process_dividend_assets(*this);
|
||||||
|
|
||||||
struct vote_tally_helper {
|
struct vote_tally_helper {
|
||||||
database& d;
|
database& d;
|
||||||
const global_property_object& props;
|
const global_property_object& props;
|
||||||
|
|
@ -1472,7 +1470,6 @@ void database::perform_chain_maintenance(const signed_block& next_block, const g
|
||||||
|
|
||||||
auto vesting_factor = calculate_vesting_factor(d, stake_account);
|
auto vesting_factor = calculate_vesting_factor(d, stake_account);
|
||||||
voting_stake = (uint64_t)floor(voting_stake * vesting_factor);
|
voting_stake = (uint64_t)floor(voting_stake * vesting_factor);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -135,6 +135,11 @@ struct proposal_operation_hardfork_visitor
|
||||||
FC_ASSERT( block_time >= HARDFORK_1000_TIME, "event_update_status_operation not allowed yet!" );
|
FC_ASSERT( block_time >= HARDFORK_1000_TIME, "event_update_status_operation not allowed yet!" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void operator()(const vesting_balance_create_operation &vbco) const {
|
||||||
|
if(block_time < HARDFORK_GPOS_TIME)
|
||||||
|
FC_ASSERT( vbco.balance_type == vesting_balance_type::unspecified, "balance_type in vesting create not allowed yet!" );
|
||||||
|
}
|
||||||
|
|
||||||
// loop and self visit in proposals
|
// loop and self visit in proposals
|
||||||
void operator()(const proposal_create_operation &v) const {
|
void operator()(const proposal_create_operation &v) const {
|
||||||
for (const op_wrapper &op : v.proposed_ops)
|
for (const op_wrapper &op : v.proposed_ops)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue