mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat(stages): bodies & TD progress (#3010)
This commit is contained in:
@ -17,4 +17,5 @@ pub enum StageEnum {
|
||||
History,
|
||||
AccountHistory,
|
||||
StorageHistory,
|
||||
TotalDifficulty,
|
||||
}
|
||||
|
||||
@ -12,7 +12,7 @@ use reth_db::{
|
||||
transaction::DbTxMut,
|
||||
};
|
||||
use reth_primitives::{stage::StageId, ChainSpec};
|
||||
use reth_staged_sync::utils::init::insert_genesis_state;
|
||||
use reth_staged_sync::utils::init::{insert_genesis_header, insert_genesis_state};
|
||||
use std::sync::Arc;
|
||||
use tracing::info;
|
||||
|
||||
@ -63,6 +63,15 @@ impl Command {
|
||||
|
||||
tool.db.update(|tx| {
|
||||
match &self.stage {
|
||||
StageEnum::Bodies => {
|
||||
tx.clear::<tables::BlockBodyIndices>()?;
|
||||
tx.clear::<tables::Transactions>()?;
|
||||
tx.clear::<tables::TransactionBlock>()?;
|
||||
tx.clear::<tables::BlockOmmers>()?;
|
||||
tx.clear::<tables::BlockWithdrawals>()?;
|
||||
tx.put::<tables::SyncStage>(StageId::Bodies.to_string(), Default::default())?;
|
||||
insert_genesis_header::<Env<WriteMap>>(tx, self.chain)?;
|
||||
}
|
||||
StageEnum::Senders => {
|
||||
tx.clear::<tables::TxSenders>()?;
|
||||
tx.put::<tables::SyncStage>(
|
||||
@ -140,6 +149,14 @@ impl Command {
|
||||
Default::default(),
|
||||
)?;
|
||||
}
|
||||
StageEnum::TotalDifficulty => {
|
||||
tx.clear::<tables::HeaderTD>()?;
|
||||
tx.put::<tables::SyncStage>(
|
||||
StageId::TotalDifficulty.to_string(),
|
||||
Default::default(),
|
||||
)?;
|
||||
insert_genesis_header::<Env<WriteMap>>(tx, self.chain)?;
|
||||
}
|
||||
_ => {
|
||||
info!("Nothing to do for stage {:?}", self.stage);
|
||||
return Ok(())
|
||||
|
||||
Reference in New Issue
Block a user