mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 19:09:54 +00:00
feat(bin): reset Finish stage in drop cmd (#2931)
This commit is contained in:
@ -61,9 +61,9 @@ impl Command {
|
|||||||
|
|
||||||
let tool = DbTool::new(&db)?;
|
let tool = DbTool::new(&db)?;
|
||||||
|
|
||||||
match &self.stage {
|
tool.db.update(|tx| {
|
||||||
StageEnum::Execution => {
|
match &self.stage {
|
||||||
tool.db.update(|tx| {
|
StageEnum::Execution => {
|
||||||
tx.clear::<tables::PlainAccountState>()?;
|
tx.clear::<tables::PlainAccountState>()?;
|
||||||
tx.clear::<tables::PlainStorageState>()?;
|
tx.clear::<tables::PlainStorageState>()?;
|
||||||
tx.clear::<tables::AccountChangeSet>()?;
|
tx.clear::<tables::AccountChangeSet>()?;
|
||||||
@ -75,11 +75,8 @@ impl Command {
|
|||||||
Default::default(),
|
Default::default(),
|
||||||
)?;
|
)?;
|
||||||
insert_genesis_state::<Env<WriteMap>>(tx, self.chain.genesis())?;
|
insert_genesis_state::<Env<WriteMap>>(tx, self.chain.genesis())?;
|
||||||
Ok::<_, eyre::Error>(())
|
}
|
||||||
})??;
|
StageEnum::Hashing => {
|
||||||
}
|
|
||||||
StageEnum::Hashing => {
|
|
||||||
tool.db.update(|tx| {
|
|
||||||
// Clear hashed accounts
|
// Clear hashed accounts
|
||||||
tx.clear::<tables::HashedAccount>()?;
|
tx.clear::<tables::HashedAccount>()?;
|
||||||
tx.put::<tables::SyncStage>(
|
tx.put::<tables::SyncStage>(
|
||||||
@ -93,12 +90,8 @@ impl Command {
|
|||||||
StageId::StorageHashing.to_string(),
|
StageId::StorageHashing.to_string(),
|
||||||
Default::default(),
|
Default::default(),
|
||||||
)?;
|
)?;
|
||||||
|
}
|
||||||
Ok::<_, eyre::Error>(())
|
StageEnum::Merkle => {
|
||||||
})??;
|
|
||||||
}
|
|
||||||
StageEnum::Merkle => {
|
|
||||||
tool.db.update(|tx| {
|
|
||||||
tx.clear::<tables::AccountsTrie>()?;
|
tx.clear::<tables::AccountsTrie>()?;
|
||||||
tx.clear::<tables::StoragesTrie>()?;
|
tx.clear::<tables::StoragesTrie>()?;
|
||||||
tx.put::<tables::SyncStage>(
|
tx.put::<tables::SyncStage>(
|
||||||
@ -113,11 +106,8 @@ impl Command {
|
|||||||
StageId::MerkleExecute.to_string(),
|
StageId::MerkleExecute.to_string(),
|
||||||
None,
|
None,
|
||||||
)?;
|
)?;
|
||||||
Ok::<_, eyre::Error>(())
|
}
|
||||||
})??;
|
StageEnum::History => {
|
||||||
}
|
|
||||||
StageEnum::History => {
|
|
||||||
tool.db.update(|tx| {
|
|
||||||
tx.clear::<tables::AccountHistory>()?;
|
tx.clear::<tables::AccountHistory>()?;
|
||||||
tx.clear::<tables::StorageHistory>()?;
|
tx.clear::<tables::StorageHistory>()?;
|
||||||
tx.put::<tables::SyncStage>(
|
tx.put::<tables::SyncStage>(
|
||||||
@ -128,13 +118,17 @@ impl Command {
|
|||||||
StageId::IndexStorageHistory.to_string(),
|
StageId::IndexStorageHistory.to_string(),
|
||||||
Default::default(),
|
Default::default(),
|
||||||
)?;
|
)?;
|
||||||
Ok::<_, eyre::Error>(())
|
}
|
||||||
})??;
|
_ => {
|
||||||
|
info!("Nothing to do for stage {:?}", self.stage);
|
||||||
|
return Ok(())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
_ => {
|
|
||||||
info!("Nothing to do for stage {:?}", self.stage);
|
tx.put::<tables::SyncStage>(StageId::Finish.to_string(), Default::default())?;
|
||||||
}
|
|
||||||
}
|
Ok::<_, eyre::Error>(())
|
||||||
|
})??;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user