[DLN] fixed missed_count for participation_rate calculateion on RNG, also hopefully fix missed block count for individual witnesses
This commit is contained in:
parent
af191e2929
commit
074817f29a
1 changed files with 27 additions and 26 deletions
|
|
@ -55,32 +55,33 @@ void database::update_global_dynamic_data( const signed_block& b )
|
||||||
#else
|
#else
|
||||||
assert( missed_blocks != 0 );
|
assert( missed_blocks != 0 );
|
||||||
#endif
|
#endif
|
||||||
if (gpo.parameters.witness_schedule_algorithm == GRAPHENE_WITNESS_SHUFFLED_ALGORITHM)
|
// bad if-condition, this code needs to execute for both shuffled and rng algorithms
|
||||||
{
|
// if (gpo.parameters.witness_schedule_algorithm == GRAPHENE_WITNESS_SHUFFLED_ALGORITHM)
|
||||||
missed_blocks--;
|
// {
|
||||||
for( uint32_t i = 0; i < missed_blocks; ++i ) {
|
missed_blocks--;
|
||||||
const auto& witness_missed = get_scheduled_witness( i+1 )(*this);
|
for( uint32_t i = 0; i < missed_blocks; ++i ) {
|
||||||
if( witness_missed.id != b.witness ) {
|
const auto& witness_missed = get_scheduled_witness( i+1 )(*this);
|
||||||
/*
|
if( witness_missed.id != b.witness ) {
|
||||||
const auto& witness_account = witness_missed.witness_account(*this);
|
/*
|
||||||
if( (fc::time_point::now() - b.timestamp) < fc::seconds(30) )
|
const auto& witness_account = witness_missed.witness_account(*this);
|
||||||
wlog( "Witness ${name} missed block ${n} around ${t}", ("name",witness_account.name)("n",b.block_num())("t",b.timestamp) );
|
if( (fc::time_point::now() - b.timestamp) < fc::seconds(30) )
|
||||||
*/
|
wlog( "Witness ${name} missed block ${n} around ${t}", ("name",witness_account.name)("n",b.block_num())("t",b.timestamp) );
|
||||||
|
*/
|
||||||
|
|
||||||
modify( witness_missed, [&]( witness_object& w ) {
|
modify( witness_missed, [&]( witness_object& w ) {
|
||||||
w.total_missed++;
|
w.total_missed++;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
// }
|
||||||
#ifdef DIRTY_TRICK
|
#ifdef DIRTY_TRICK
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
// dynamic global properties updating
|
// dynamic global properties updating
|
||||||
modify( _dgp, [&]( dynamic_global_property_object& dgp ){
|
modify( _dgp, [&]( dynamic_global_property_object& dgp ){
|
||||||
secret_hash_type::encoder enc;
|
secret_hash_type::encoder enc;
|
||||||
fc::raw::pack( enc, dgp.random );
|
fc::raw::pack( enc, dgp.random );
|
||||||
fc::raw::pack( enc, b.previous_secret );
|
fc::raw::pack( enc, b.previous_secret );
|
||||||
dgp.random = enc.result();
|
dgp.random = enc.result();
|
||||||
|
|
||||||
_random_number_generator = fc::hash_ctr_rng<secret_hash_type, 20>(dgp.random.data());
|
_random_number_generator = fc::hash_ctr_rng<secret_hash_type, 20>(dgp.random.data());
|
||||||
|
|
@ -257,7 +258,7 @@ bool database::check_for_blackswan( const asset_object& mia, bool enable_black_s
|
||||||
}
|
}
|
||||||
|
|
||||||
auto least_collateral = call_itr->collateralization();
|
auto least_collateral = call_itr->collateralization();
|
||||||
if( ~least_collateral >= highest )
|
if( ~least_collateral >= highest )
|
||||||
{
|
{
|
||||||
elog( "Black Swan detected: \n"
|
elog( "Black Swan detected: \n"
|
||||||
" Least collateralized call: ${lc} ${~lc}\n"
|
" Least collateralized call: ${lc} ${~lc}\n"
|
||||||
|
|
@ -271,7 +272,7 @@ bool database::check_for_blackswan( const asset_object& mia, bool enable_black_s
|
||||||
FC_ASSERT( enable_black_swan, "Black swan was detected during a margin update which is not allowed to trigger a blackswan" );
|
FC_ASSERT( enable_black_swan, "Black swan was detected during a margin update which is not allowed to trigger a blackswan" );
|
||||||
globally_settle_asset(mia, ~least_collateral );
|
globally_settle_asset(mia, ~least_collateral );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -428,8 +429,8 @@ void database::clear_expired_orders()
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
settled += match(*itr, order, settlement_price, max_settlement);
|
settled += match(*itr, order, settlement_price, max_settlement);
|
||||||
}
|
}
|
||||||
catch ( const black_swan_exception& e ) {
|
catch ( const black_swan_exception& e ) {
|
||||||
wlog( "black swan detected: ${e}", ("e", e.to_detail_string() ) );
|
wlog( "black swan detected: ${e}", ("e", e.to_detail_string() ) );
|
||||||
cancel_order( order );
|
cancel_order( order );
|
||||||
break;
|
break;
|
||||||
|
|
@ -552,7 +553,7 @@ void start_fully_registered_tournaments(database& db)
|
||||||
// find the first tournament waiting to start; if its start time has arrived, start it
|
// find the first tournament waiting to start; if its start time has arrived, start it
|
||||||
auto start_iter = start_time_index.lower_bound(boost::make_tuple(tournament_state::awaiting_start));
|
auto start_iter = start_time_index.lower_bound(boost::make_tuple(tournament_state::awaiting_start));
|
||||||
if (start_iter != start_time_index.end() &&
|
if (start_iter != start_time_index.end() &&
|
||||||
start_iter->get_state() == tournament_state::awaiting_start &&
|
start_iter->get_state() == tournament_state::awaiting_start &&
|
||||||
*start_iter->start_time <= db.head_block_time())
|
*start_iter->start_time <= db.head_block_time())
|
||||||
{
|
{
|
||||||
db.modify(*start_iter, [&](tournament_object& t) {
|
db.modify(*start_iter, [&](tournament_object& t) {
|
||||||
|
|
@ -575,7 +576,7 @@ void initiate_next_games(database& db)
|
||||||
auto& next_timeout_index = db.get_index_type<game_index>().indices().get<by_next_timeout>();
|
auto& next_timeout_index = db.get_index_type<game_index>().indices().get<by_next_timeout>();
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
// empty time_points are sorted to the beginning, so upper_bound takes us to the first
|
// empty time_points are sorted to the beginning, so upper_bound takes us to the first
|
||||||
// non-empty time_point
|
// non-empty time_point
|
||||||
auto start_iter = next_timeout_index.upper_bound(boost::make_tuple(optional<time_point_sec>()));
|
auto start_iter = next_timeout_index.upper_bound(boost::make_tuple(optional<time_point_sec>()));
|
||||||
if (start_iter != next_timeout_index.end() &&
|
if (start_iter != next_timeout_index.end() &&
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue