diff --git a/emily/handler/src/api/handlers/internal.rs b/emily/handler/src/api/handlers/internal.rs index cf1aea415..94a9c7571 100644 --- a/emily/handler/src/api/handlers/internal.rs +++ b/emily/handler/src/api/handlers/internal.rs @@ -113,9 +113,9 @@ pub async fn execute_reorg_handler( // and withdrawal table we'll wipe out all the history that's no longer relevant. // Get all deposits that would be impacted by this reorg. - let all_deposits = accessors::get_all_deposit_entries_modified_after_height( + let all_deposits = accessors::get_all_deposit_entries_modified_from_height( context, - request.canonical_tip.stacks_block_height - 1, + request.canonical_tip.stacks_block_height, None, ) .await?; @@ -152,9 +152,9 @@ pub async fn execute_reorg_handler( ); // Get all withdrawals that would be impacted by this reorg. - let all_withdrawals = accessors::get_all_withdrawal_entries_modified_after_height( + let all_withdrawals = accessors::get_all_withdrawal_entries_modified_from_height( context, - request.canonical_tip.stacks_block_height - 1, + request.canonical_tip.stacks_block_height, None, ) .await?; diff --git a/emily/handler/src/database/accessors.rs b/emily/handler/src/database/accessors.rs index 6af744edc..6a146e16b 100644 --- a/emily/handler/src/database/accessors.rs +++ b/emily/handler/src/database/accessors.rs @@ -87,15 +87,15 @@ const ALL_STATUSES: &[Status] = &[ Status::Reprocessing, ]; -/// Gets all deposit entries modified after a given height. -pub async fn get_all_deposit_entries_modified_after_height( +/// Gets all deposit entries modified from (on or after) a given height. +pub async fn get_all_deposit_entries_modified_from_height( context: &EmilyContext, minimum_height: u64, maybe_page_size: Option, ) -> Result, Error> { let mut all = Vec::new(); for status in ALL_STATUSES { - let mut received = get_all_deposit_entries_modified_after_height_with_status( + let mut received = get_all_deposit_entries_modified_from_height_with_status( context, status, minimum_height, @@ -108,8 +108,8 @@ pub async fn get_all_deposit_entries_modified_after_height( Ok(all) } -/// Gets all deposit entries modified after a given height. -pub async fn get_all_deposit_entries_modified_after_height_with_status( +/// Gets all deposit entries modified from (on or after) a given height. +pub async fn get_all_deposit_entries_modified_from_height_with_status( context: &EmilyContext, status: &Status, minimum_height: u64, @@ -120,7 +120,7 @@ pub async fn get_all_deposit_entries_modified_after_height_with_status( context, status, &minimum_height, - ">", + ">=", maybe_page_size, ) .await @@ -303,15 +303,15 @@ pub async fn get_withdrawal_entries( .await } -/// Gets all withdrawal entries modified after a given height. -pub async fn get_all_withdrawal_entries_modified_after_height( +/// Gets all withdrawal entries modified from (on or after) a given height. +pub async fn get_all_withdrawal_entries_modified_from_height( context: &EmilyContext, minimum_height: u64, maybe_page_size: Option, ) -> Result, Error> { let mut all = Vec::new(); for status in ALL_STATUSES { - let mut received = get_all_withdrawal_entries_modified_after_height_with_status( + let mut received = get_all_withdrawal_entries_modified_from_height_with_status( context, status, minimum_height, @@ -324,8 +324,8 @@ pub async fn get_all_withdrawal_entries_modified_after_height( Ok(all) } -/// Gets all withdrawal entries modified after a given height. -pub async fn get_all_withdrawal_entries_modified_after_height_with_status( +/// Gets all withdrawal entries modified from (on or after) a given height. +pub async fn get_all_withdrawal_entries_modified_from_height_with_status( context: &EmilyContext, status: &Status, minimum_height: u64, @@ -336,7 +336,7 @@ pub async fn get_all_withdrawal_entries_modified_after_height_with_status( context, status, &minimum_height, - ">", + ">=", maybe_page_size, ) .await