Skip to content

Commit

Permalink
fix(core): periodically commit large transaction in prune_to_height (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
sdbondi committed Oct 18, 2022
1 parent dceea99 commit 700a007
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 23 deletions.
46 changes: 23 additions & 23 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions base_layer/core/src/chain_storage/blockchain_database.rs
Expand Up @@ -2374,6 +2374,10 @@ fn prune_to_height<T: BlockchainBackend>(db: &mut T, target_horizon_height: u64)

txn.prune_outputs_at_positions(output_mmr_positions.to_vec());
txn.delete_all_inputs_in_block(*header.hash());
if txn.operations().len() >= 100 {
txn.set_pruned_height(block_to_prune);
db.write(mem::take(&mut txn))?;
}
}

txn.set_pruned_height(target_horizon_height);
Expand Down

0 comments on commit 700a007

Please sign in to comment.