mirror of
https://github.com/0glabs/0g-storage-node.git
synced 2025-04-04 15:35:18 +00:00
fix.
This commit is contained in:
parent
5e14db6422
commit
b16abe2303
@ -37,3 +37,7 @@ enr = { path = "version-meld/enr" }
|
||||
|
||||
[profile.bench.package.'storage']
|
||||
debug = true
|
||||
|
||||
[profile.dev]
|
||||
# enabling debug_assertions will make node fail to start because of checks in `clap`.
|
||||
debug-assertions = false
|
@ -556,7 +556,7 @@ impl<E: HashElement, A: Algorithm<E>> AppendMerkleTree<E, A> {
|
||||
.ok_or_else(|| anyhow!("tx_seq unavailable, root={:?}", tx_seq))?
|
||||
.clone();
|
||||
// Dropping the upper layers that are not in the old merkle tree.
|
||||
for height in (self.height() - 1)..=delta_nodes.right_most_nodes.len() {
|
||||
for height in (delta_nodes.right_most_nodes.len()..(self.height() - 1)).rev() {
|
||||
self.node_manager.truncate_layer(height);
|
||||
}
|
||||
for (height, (last_index, right_most_node)) in
|
||||
@ -592,13 +592,15 @@ impl<E: HashElement, A: Algorithm<E>> AppendMerkleTree<E, A> {
|
||||
}
|
||||
|
||||
pub fn reset(&mut self) {
|
||||
for height in (self.height() - 1)..=0 {
|
||||
for height in (0..self.height()).rev() {
|
||||
self.node_manager.truncate_layer(height);
|
||||
}
|
||||
if let Some(depth) = self.min_depth {
|
||||
for _ in 0..depth {
|
||||
self.node_manager.add_layer();
|
||||
}
|
||||
} else {
|
||||
self.node_manager.add_layer();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -94,6 +94,7 @@ impl MerkleManager {
|
||||
}
|
||||
|
||||
fn revert_merkle_tree(&mut self, tx_seq: u64, tx_store: &TransactionStore) -> Result<()> {
|
||||
debug!("revert merkle tree {}", tx_seq);
|
||||
// Special case for reverting tx_seq == 0
|
||||
if tx_seq == u64::MAX {
|
||||
self.pora_chunks_merkle.reset();
|
||||
|
Loading…
Reference in New Issue
Block a user