fix: unwind_to should be exclusive (#10738)

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
Alexxxxxx
2024-09-07 00:03:33 +08:00
committed by GitHub
parent a89de219c9
commit dbf5d48a82
2 changed files with 5 additions and 2 deletions

View File

@@ -317,8 +317,9 @@ where
// First unwind the db tables, until the unwind_to block number. use the walker to unwind
// HeaderNumbers based on the index in CanonicalHeaders
// unwind from the next block number since the unwind_to block is exclusive
provider.unwind_table_by_walker::<tables::CanonicalHeaders, tables::HeaderNumbers>(
input.unwind_to..,
(input.unwind_to + 1)..,
)?;
provider.unwind_table_by_num::<tables::CanonicalHeaders>(input.unwind_to)?;
provider.unwind_table_by_num::<tables::HeaderTerminalDifficulties>(input.unwind_to)?;

View File

@@ -1500,7 +1500,9 @@ impl<TX: DbTxMut + DbTx> DatabaseProvider<TX> {
Ok(deleted)
}
/// Unwind a table forward by a [`Walker`][reth_db_api::cursor::Walker] on another table
/// Unwind a table forward by a [`Walker`][reth_db_api::cursor::Walker] on another table.
///
/// Note: Range is inclusive and first key in the range is removed.
pub fn unwind_table_by_walker<T1, T2>(
&self,
range: impl RangeBounds<T1::Key>,