mirror of
https://github.com/oxen-io/oxen-core.git
synced 2023-12-14 02:22:56 +01:00
Simplify print_sn, don't calc auto-stake, fix timestamp used as block height
This commit is contained in:
parent
db3bac912e
commit
3cdc34d01c
1 changed files with 15 additions and 19 deletions
|
@ -2036,38 +2036,34 @@ static void print_service_node_list_state(cryptonote::network_type nettype, uint
|
|||
|
||||
// Print Expiry Info
|
||||
{
|
||||
uint64_t expiry_height_auto_stake = entry.registration_height + STAKING_AUTHORIZATION_EXPIRATION_AUTOSTAKE;
|
||||
uint64_t expiry_height = entry.registration_height;
|
||||
|
||||
uint64_t expiry_height = entry.registration_height;
|
||||
if (is_registered) expiry_height += (nettype == cryptonote::TESTNET) ? STAKING_REQUIREMENT_LOCK_BLOCKS_TESTNET : STAKING_REQUIREMENT_LOCK_BLOCKS;
|
||||
else expiry_height += STAKING_AUTHORIZATION_EXPIRATION_WINDOW;
|
||||
else expiry_height += (STAKING_AUTHORIZATION_EXPIRATION_WINDOW / DIFFICULTY_TARGET_V2);
|
||||
|
||||
if (curr_height)
|
||||
{
|
||||
uint64_t now = time(nullptr);
|
||||
uint64_t delta_height = expiry_height - *curr_height;
|
||||
uint64_t delta_height_auto_stake = expiry_height_auto_stake - *curr_height;
|
||||
uint64_t delta_height = expiry_height - *curr_height;
|
||||
uint64_t expiry_epoch_time = now + (delta_height * DIFFICULTY_TARGET_V2);
|
||||
|
||||
uint64_t expiry_epoch_time = now + (delta_height * DIFFICULTY_TARGET_V2);
|
||||
uint64_t expiry_epoch_time_auto_stake = now + (delta_height_auto_stake * DIFFICULTY_TARGET_V2);
|
||||
tools::msg_writer() << indent2 << "Registration Height/Expiry Height: " << entry.registration_height << "/" << expiry_height
|
||||
<< " (in " << delta_height << " blocks) or UTC: " << get_date_time(expiry_epoch_time) << " (" << get_human_time_ago(expiry_epoch_time, now) << ")";
|
||||
|
||||
if (is_registered)
|
||||
if (!is_registered)
|
||||
{
|
||||
tools::msg_writer() << indent2 << "Registration Height/Expiry Height: " << entry.registration_height << " / " << expiry_height << " (in " << delta_height << " blocks)"
|
||||
<< " or if auto staking " << expiry_height_auto_stake << " (in " << delta_height_auto_stake << " blocks)";
|
||||
}
|
||||
else
|
||||
{
|
||||
tools::msg_writer() << indent2 << "Registration Height/Expiry Height: " << entry.registration_height << " / " << expiry_height << " (in " << delta_height << " blocks)";
|
||||
uint64_t open_for_contrib_until_height = entry.registration_height + (STAKING_AUTHORIZATION_EXPIRATION_WINDOW / DIFFICULTY_TARGET_V2);
|
||||
uint64_t open_for_contrib_height_delta = open_for_contrib_until_height - *curr_height;
|
||||
uint64_t open_for_contrib_expiry_time = now + (open_for_contrib_height_delta * DIFFICULTY_TARGET_V2);
|
||||
|
||||
tools::msg_writer() << indent2 << "Open For Contribution Until: " << open_for_contrib_until_height << "/"
|
||||
<< " (in " << open_for_contrib_height_delta << " blocks) or UTC: "
|
||||
<< get_date_time(open_for_contrib_expiry_time) << " (" << get_human_time_ago(open_for_contrib_expiry_time, now) << ")";
|
||||
}
|
||||
|
||||
tools::msg_writer() << indent2 << "Expiry Date (Estimated UTC): " << get_date_time(expiry_epoch_time) << " (" << get_human_time_ago(expiry_epoch_time, now) << ")"
|
||||
<< " or if auto staking " << get_date_time(expiry_epoch_time_auto_stake) << " (" << get_human_time_ago(expiry_epoch_time_auto_stake, now) << ")";
|
||||
}
|
||||
else
|
||||
{
|
||||
tools::msg_writer() << indent2 << "Registration Height/Expiry Height: " << entry.registration_height << " / " << expiry_height << " (in ?? blocks) "
|
||||
<< " or if auto staking " << expiry_height_auto_stake << " (in ?? blocks)";
|
||||
tools::msg_writer() << indent2 << "Registration Height/Expiry Height: " << entry.registration_height << " / " << expiry_height << " (in ?? blocks) ";
|
||||
tools::msg_writer() << indent2 << "Expiry Date (Estimated UTC): ?? (Could not get current blockchain height)";
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue