implement rolling_period_start function
This commit is contained in:
parent
602b8530da
commit
6b533828db
1 changed files with 20 additions and 0 deletions
|
|
@ -828,6 +828,24 @@ share_type credit_account(database& db, const account_id_type owner_id, const st
|
||||||
return remaining_amount_to_distribute;
|
return remaining_amount_to_distribute;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void rolling_period_start(database& db)
|
||||||
|
{
|
||||||
|
if(db.head_block_time() >= HARDFORK_GPOS_TIME)
|
||||||
|
{
|
||||||
|
auto period_start = db.get_global_properties().parameters.period_start;
|
||||||
|
auto vesting_period = db.get_global_properties().parameters.vesting_period;
|
||||||
|
|
||||||
|
auto now = db.head_block_time().sec_since_epoch();
|
||||||
|
if(now > (period_start + vesting_period))
|
||||||
|
{
|
||||||
|
// roll
|
||||||
|
db.modify(db.get_global_properties(), [now](global_property_object& p) {
|
||||||
|
p.parameters.period_start = now;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Schedules payouts from a dividend distribution account to the current holders of the
|
// Schedules payouts from a dividend distribution account to the current holders of the
|
||||||
// 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
|
||||||
|
|
@ -1377,6 +1395,8 @@ void database::perform_chain_maintenance(const signed_block& next_block, const g
|
||||||
|
|
||||||
process_dividend_assets(*this);
|
process_dividend_assets(*this);
|
||||||
|
|
||||||
|
rolling_period_start(*this);
|
||||||
|
|
||||||
struct vote_tally_helper {
|
struct vote_tally_helper {
|
||||||
database& d;
|
database& d;
|
||||||
const global_property_object& props;
|
const global_property_object& props;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue