Skip to content

Commit

Permalink
Remove clearing functionality from the tree cache updater
Browse files Browse the repository at this point in the history
  • Loading branch information
popzxc committed Mar 29, 2022
1 parent 4904dc1 commit 4c3e987
Showing 1 changed file with 0 additions and 18 deletions.
18 changes: 0 additions & 18 deletions core/bin/tree_cache_updater/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ struct Opt {
/// Maximum amount of blocks to convert.
#[structopt(long)]
max_blocks: usize,
/// Whether to remove all the old JSON caches or not.
#[structopt(long)]
clear_old: bool,
}

#[tokio::main]
Expand All @@ -37,10 +34,6 @@ async fn main() -> anyhow::Result<()> {
"I'm going to convert caches for blocks from {} to {}",
min_block, max_block.0
);
if opt.clear_old {
println!("Also, all the old JSON caches will be removed completely from the database");
}

println!("Database URL is {}", DBConfig::from_env().url);
println!("Proceed? [y/n]");

Expand Down Expand Up @@ -74,17 +67,6 @@ async fn main() -> anyhow::Result<()> {
println!("Block {} processed", block);
}

// We've processed all the blocks. Now, if user requested, we'll remove all the old caches.
if opt.clear_old {
// BlockNumber(0) because range is not inclusive. Everything starting from block 1 will be removed.
transaction
.chain()
.tree_cache_schema_json()
.remove_new_account_tree_cache(BlockNumber(0))
.await?;
println!("Old caches removed");
}

transaction.commit().await?;

println!("Done");
Expand Down

0 comments on commit 4c3e987

Please sign in to comment.