Skip to content

Commit

Permalink
Move faster to a new activation window
Browse files Browse the repository at this point in the history
If we are already in a new activation window, there is no need to generate the previous genesis.
  • Loading branch information
viquezclaudio authored and jsdanielh committed Apr 23, 2024
1 parent dc513e2 commit 58a2b3f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pow-migration/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,17 @@ pub async fn migrate(
let current_height = pow_client.block_number().await.unwrap();
log::info!(current_height);

let next_candidate = candidate_block + block_windows.readiness_window;

if current_height > next_candidate {
log::info!(
next_candidate = next_candidate,
"The activation window already finished, moving to the next one"
);

return Ok(None);
}

// We are past the election candidate, so we are now in one of the activation windows
if current_height > candidate_block + block_windows.block_confirmations {
// Start the PoS genesis generation process
Expand Down

0 comments on commit 58a2b3f

Please sign in to comment.