#433 Down active sons are not substituted

This commit is contained in:
Milos Milosevic 2022-11-15 22:33:04 +00:00 committed by serkixenos
parent 3ebcd29e10
commit 8853a76752
4 changed files with 12 additions and 12 deletions

View file

@ -1912,7 +1912,7 @@ map<son_id_type, string> database_api_impl::get_son_network_status_by_sidechain(
if (time_point_sec(sso.last_active_timestamp.at(sidechain) + fc::seconds(gpo.parameters.son_down_time())) > _db.head_block_time()) { if (time_point_sec(sso.last_active_timestamp.at(sidechain) + fc::seconds(gpo.parameters.son_down_time())) > _db.head_block_time()) {
status = "OK, irregular SON heartbeat, but not triggering SON down proposal"; status = "OK, irregular SON heartbeat, but not triggering SON down proposal";
} else { } else {
status = "NOT OK, irregular SON heartbeat, triggering SON down proposal]"; status = "NOT OK, irregular SON heartbeat, triggering SON down proposal";
} }
} }
} else { } else {

View file

@ -236,7 +236,7 @@ std::set<son_id_type> database::get_sons_to_be_deregistered()
// TODO : We need to add a function that returns if we can deregister SON // TODO : We need to add a function that returns if we can deregister SON
// i.e. with introduction of PW code, we have to make a decision if the SON // i.e. with introduction of PW code, we have to make a decision if the SON
// is needed for release of funds from the PW // is needed for release of funds from the PW
if (head_block_time() - stats.last_down_timestamp.at(sidechain) < fc::seconds(get_global_properties().parameters.son_deregister_time())) { if (head_block_time() - stats.last_active_timestamp.at(sidechain) < fc::seconds(get_global_properties().parameters.son_deregister_time())) {
need_to_be_deregistered = false; need_to_be_deregistered = false;
} }
} }
@ -311,7 +311,7 @@ bool database::is_son_dereg_valid( son_id_type son_id )
if(status_son_dereg_valid) if(status_son_dereg_valid)
{ {
if(head_block_time() - son->statistics(*this).last_down_timestamp.at(sidechain) < fc::seconds(get_global_properties().parameters.son_deregister_time())) if(head_block_time() - son->statistics(*this).last_active_timestamp.at(sidechain) < fc::seconds(get_global_properties().parameters.son_deregister_time()))
{ {
status_son_dereg_valid = false; status_son_dereg_valid = false;
} }

View file

@ -1313,7 +1313,7 @@ BOOST_FIXTURE_TEST_CASE( get_son_network_status, cli_fixture )
(inner_iter->first == gpo.active_sons.at(sidechain_type::ethereum).at(0).son_id)) (inner_iter->first == gpo.active_sons.at(sidechain_type::ethereum).at(0).son_id))
{ {
BOOST_TEST_MESSAGE("status: "<< inner_iter->second); BOOST_TEST_MESSAGE("status: "<< inner_iter->second);
BOOST_CHECK(inner_iter->second == "NOT OK, irregular SON heartbeat, triggering SON down proposal]"); BOOST_CHECK(inner_iter->second == "NOT OK, irregular SON heartbeat, triggering SON down proposal");
} }
else if((inner_iter->first == gpo.active_sons.at(sidechain_type::bitcoin).at(1).son_id) && else if((inner_iter->first == gpo.active_sons.at(sidechain_type::bitcoin).at(1).son_id) &&
(inner_iter->first == gpo.active_sons.at(sidechain_type::hive).at(1).son_id) && (inner_iter->first == gpo.active_sons.at(sidechain_type::hive).at(1).son_id) &&
@ -1342,14 +1342,14 @@ BOOST_FIXTURE_TEST_CASE( get_son_network_status, cli_fixture )
(inner_iter->first == gpo.active_sons.at(sidechain_type::ethereum).at(0).son_id)) (inner_iter->first == gpo.active_sons.at(sidechain_type::ethereum).at(0).son_id))
{ {
BOOST_TEST_MESSAGE("status: "<< inner_iter->second); BOOST_TEST_MESSAGE("status: "<< inner_iter->second);
BOOST_CHECK(inner_iter->second == "NOT OK, irregular SON heartbeat, triggering SON down proposal]"); BOOST_CHECK(inner_iter->second == "NOT OK, irregular SON heartbeat, triggering SON down proposal");
} }
else if((inner_iter->first == gpo.active_sons.at(sidechain_type::bitcoin).at(1).son_id) && else if((inner_iter->first == gpo.active_sons.at(sidechain_type::bitcoin).at(1).son_id) &&
(inner_iter->first == gpo.active_sons.at(sidechain_type::hive).at(1).son_id) && (inner_iter->first == gpo.active_sons.at(sidechain_type::hive).at(1).son_id) &&
(inner_iter->first == gpo.active_sons.at(sidechain_type::ethereum).at(1).son_id)) (inner_iter->first == gpo.active_sons.at(sidechain_type::ethereum).at(1).son_id))
{ {
BOOST_TEST_MESSAGE("status: "<< inner_iter->second); BOOST_TEST_MESSAGE("status: "<< inner_iter->second);
BOOST_CHECK(inner_iter->second == "NOT OK, irregular SON heartbeat, triggering SON down proposal]"); BOOST_CHECK(inner_iter->second == "NOT OK, irregular SON heartbeat, triggering SON down proposal");
} }
else{ else{
BOOST_TEST_MESSAGE("status: "<< inner_iter->second); BOOST_TEST_MESSAGE("status: "<< inner_iter->second);
@ -1517,7 +1517,7 @@ BOOST_FIXTURE_TEST_CASE( get_son_network_status_by_sidechain, cli_fixture )
(iter->first == gpo.active_sons.at(sidechain_type::ethereum).at(0).son_id)) (iter->first == gpo.active_sons.at(sidechain_type::ethereum).at(0).son_id))
{ {
BOOST_TEST_MESSAGE("status: "<< iter->second); BOOST_TEST_MESSAGE("status: "<< iter->second);
BOOST_CHECK(iter->second == "NOT OK, irregular SON heartbeat, triggering SON down proposal]"); BOOST_CHECK(iter->second == "NOT OK, irregular SON heartbeat, triggering SON down proposal");
} }
else if((iter->first == gpo.active_sons.at(sidechain_type::bitcoin).at(1).son_id) && else if((iter->first == gpo.active_sons.at(sidechain_type::bitcoin).at(1).son_id) &&
(iter->first == gpo.active_sons.at(sidechain_type::hive).at(1).son_id) && (iter->first == gpo.active_sons.at(sidechain_type::hive).at(1).son_id) &&
@ -1545,14 +1545,14 @@ BOOST_FIXTURE_TEST_CASE( get_son_network_status_by_sidechain, cli_fixture )
(iter->first == gpo.active_sons.at(sidechain_type::ethereum).at(0).son_id)) (iter->first == gpo.active_sons.at(sidechain_type::ethereum).at(0).son_id))
{ {
BOOST_TEST_MESSAGE("status: "<< iter->second); BOOST_TEST_MESSAGE("status: "<< iter->second);
BOOST_CHECK(iter->second == "NOT OK, irregular SON heartbeat, triggering SON down proposal]"); BOOST_CHECK(iter->second == "NOT OK, irregular SON heartbeat, triggering SON down proposal");
} }
else if((iter->first == gpo.active_sons.at(sidechain_type::bitcoin).at(1).son_id) && else if((iter->first == gpo.active_sons.at(sidechain_type::bitcoin).at(1).son_id) &&
(iter->first == gpo.active_sons.at(sidechain_type::hive).at(1).son_id) && (iter->first == gpo.active_sons.at(sidechain_type::hive).at(1).son_id) &&
(iter->first == gpo.active_sons.at(sidechain_type::ethereum).at(1).son_id)) (iter->first == gpo.active_sons.at(sidechain_type::ethereum).at(1).son_id))
{ {
BOOST_TEST_MESSAGE("status: "<< iter->second); BOOST_TEST_MESSAGE("status: "<< iter->second);
BOOST_CHECK(iter->second == "NOT OK, irregular SON heartbeat, triggering SON down proposal]"); BOOST_CHECK(iter->second == "NOT OK, irregular SON heartbeat, triggering SON down proposal");
} }
else{ else{
BOOST_TEST_MESSAGE("status: "<< iter->second); BOOST_TEST_MESSAGE("status: "<< iter->second);

View file

@ -208,9 +208,9 @@ try {
db.modify( *son_stats_obj, [&]( son_statistics_object& _s) db.modify( *son_stats_obj, [&]( son_statistics_object& _s)
{ {
_s.last_down_timestamp[sidechain_type::bitcoin] = fc::time_point_sec(db.head_block_time() - db.get_global_properties().parameters.son_deregister_time()); _s.last_active_timestamp[sidechain_type::bitcoin] = fc::time_point_sec(db.head_block_time() - db.get_global_properties().parameters.son_deregister_time());
_s.last_down_timestamp[sidechain_type::hive] = fc::time_point_sec(db.head_block_time() - db.get_global_properties().parameters.son_deregister_time()); _s.last_active_timestamp[sidechain_type::hive] = fc::time_point_sec(db.head_block_time() - db.get_global_properties().parameters.son_deregister_time());
_s.last_down_timestamp[sidechain_type::ethereum] = fc::time_point_sec(db.head_block_time() - db.get_global_properties().parameters.son_deregister_time()); _s.last_active_timestamp[sidechain_type::ethereum] = fc::time_point_sec(db.head_block_time() - db.get_global_properties().parameters.son_deregister_time());
}); });
auto deposit_vesting = db.get<vesting_balance_object>(vesting_balance_id_type(0)); auto deposit_vesting = db.get<vesting_balance_object>(vesting_balance_id_type(0));