feat(stages): unwind on detached local head (#3066)

This commit is contained in:
Roman Krasiuk
2023-06-09 20:35:46 +03:00
committed by GitHub
parent b414eee015
commit 1ff26dd2fd
14 changed files with 262 additions and 134 deletions

View File

@ -89,6 +89,16 @@ pub const EMPTY_TRANSACTIONS: H256 = EMPTY_SET_HASH;
/// Withdrawals root of empty withdrawals set.
pub const EMPTY_WITHDRAWALS: H256 = EMPTY_SET_HASH;
/// The number of blocks to unwind during a reorg that already became a part of canonical chain.
///
/// In reality, the node can end up in this particular situation very rarely. It would happen only
/// if the node process is abruptly terminated during ongoing reorg and doesn't boot back up for
/// long period of time.
///
/// Unwind depth of `3` blocks significantly reduces the chance that the reorged block is kept in
/// the database.
pub const BEACON_CONSENSUS_REORG_UNWIND_DEPTH: u64 = 3;
#[cfg(test)]
mod tests {
use super::*;