GPOS2 HF - Handle rolling period on missing blocks
This commit is contained in:
parent
490a332db1
commit
4c5deb1772
2 changed files with 14 additions and 5 deletions
|
|
@ -803,8 +803,6 @@ uint32_t database::get_gpos_current_subperiod()
|
||||||
const auto now = this->head_block_time();
|
const auto now = this->head_block_time();
|
||||||
auto seconds_since_period_start = now.sec_since_epoch() - period_start.sec_since_epoch();
|
auto seconds_since_period_start = now.sec_since_epoch() - period_start.sec_since_epoch();
|
||||||
|
|
||||||
FC_ASSERT(period_start <= now && now <= period_end);
|
|
||||||
|
|
||||||
// get in what sub period we are
|
// get in what sub period we are
|
||||||
uint32_t current_subperiod = 0;
|
uint32_t current_subperiod = 0;
|
||||||
std::list<uint32_t> period_list(number_of_subperiods);
|
std::list<uint32_t> period_list(number_of_subperiods);
|
||||||
|
|
@ -926,9 +924,16 @@ void rolling_period_start(database& db)
|
||||||
if(now.sec_since_epoch() >= (period_start + vesting_period))
|
if(now.sec_since_epoch() >= (period_start + vesting_period))
|
||||||
{
|
{
|
||||||
// roll
|
// roll
|
||||||
db.modify(db.get_global_properties(), [now](global_property_object& p) {
|
if(db.head_block_time() >= HARDFORK_GPOS2_TIME)
|
||||||
p.parameters.extensions.value.gpos_period_start = now.sec_since_epoch();
|
{
|
||||||
});
|
db.modify(db.get_global_properties(), [period_start, vesting_period](global_property_object& p) {
|
||||||
|
p.parameters.extensions.value.gpos_period_start = period_start + vesting_period;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
db.modify(db.get_global_properties(), [now](global_property_object& p) {
|
||||||
|
p.parameters.extensions.value.gpos_period_start = now.sec_since_epoch();
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
4
libraries/chain/hardfork.d/GPOS2.hf
Normal file
4
libraries/chain/hardfork.d/GPOS2.hf
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
// GPOS2 HARDFORK Tuesday, 28 July 2020 01:00:00 GMT
|
||||||
|
#ifndef HARDFORK_GPOS2_TIME
|
||||||
|
#define HARDFORK_GPOS2_TIME (fc::time_point_sec( 1595898000 ))
|
||||||
|
#endif
|
||||||
Loading…
Reference in a new issue