mirror of
https://github.com/0glabs/0g-storage-node.git
synced 2025-01-12 08:05:17 +00:00
Allow reverting the last tx with no flow data update. (#51)
* Allow reverting the last tx with no flow data update. * Add details for panic.
This commit is contained in:
parent
8cff5dabe7
commit
f5a71375be
@ -188,7 +188,10 @@ impl<E: HashElement, A: Algorithm<E>> AppendMerkleTree<E, A> {
|
|||||||
self.layers[0][index] = leaf;
|
self.layers[0][index] = leaf;
|
||||||
self.recompute_after_fill_leaves(index, index + 1);
|
self.recompute_after_fill_leaves(index, index + 1);
|
||||||
} else if self.layers[0][index] != leaf {
|
} else if self.layers[0][index] != leaf {
|
||||||
panic!("Fill with invalid leaf")
|
panic!(
|
||||||
|
"Fill with invalid leaf, index={} was={:?} get={:?}",
|
||||||
|
index, self.layers[0][index], leaf
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -535,12 +535,19 @@ impl LogManager {
|
|||||||
+ previous_tx.num_entries() as u64)
|
+ previous_tx.num_entries() as u64)
|
||||||
/ PORA_CHUNK_SIZE as u64)
|
/ PORA_CHUNK_SIZE as u64)
|
||||||
as usize;
|
as usize;
|
||||||
assert!(current_len > expected_len);
|
if current_len > expected_len {
|
||||||
while let Some((subtree_depth, _)) = initial_data.subtree_list.pop() {
|
while let Some((subtree_depth, _)) = initial_data.subtree_list.pop()
|
||||||
current_len -= 1 << (subtree_depth - 1);
|
{
|
||||||
if current_len == expected_len {
|
current_len -= 1 << (subtree_depth - 1);
|
||||||
break;
|
if current_len == expected_len {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
warn!(
|
||||||
|
"revert last tx with no-op: {} {}",
|
||||||
|
current_len, expected_len
|
||||||
|
);
|
||||||
}
|
}
|
||||||
assert_eq!(current_len, expected_len);
|
assert_eq!(current_len, expected_len);
|
||||||
while let Some((index, h)) = initial_data.known_leaves.pop() {
|
while let Some((index, h)) = initial_data.known_leaves.pop() {
|
||||||
|
Loading…
Reference in New Issue
Block a user