Skip to content

Commit

Permalink
add some more docs wrt snapshot tx num != db tx num
Browse files Browse the repository at this point in the history
  • Loading branch information
joshieDo committed Jan 23, 2024
1 parent 2a5fc4f commit 782f7e3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions crates/stages/src/stages/bodies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,14 @@ impl<DB: Database, D: BodyDownloader> Stage<DB> for BodyStage<D> {
.unwrap_or_default();

match next_snapshot_tx_num.cmp(&next_tx_num) {
// If static files are ahead, then we didn't reach the database commit in a previous
// stage run. So, our only solution is to unwind the static files and proceed from the
// database expected height.
Ordering::Greater => snapshotter
.prune_transactions(next_snapshot_tx_num - next_tx_num, from_block - 1)?,
// If static files are behind, then there was some corruption or loss of files. This
// error will trigger an unwind, that will bring the database to the same height as the
// static files.
Ordering::Less => {
let last_block = snapshot_provider
.get_highest_snapshot_block(SnapshotSegment::Transactions)
Expand Down

0 comments on commit 782f7e3

Please sign in to comment.