parallelchain-io / hotstuff_rs

Rust implementation of the HotStuff consensus algorithm.
34 stars 4 forks source link

The siblings of a pruned block are not deleted from the `BlockTree` #22

Closed karolinagrzeszkiewicz closed 5 months ago

karolinagrzeszkiewicz commented 8 months ago

When a block is pruned delete_siblings is called to delete its siblings. This calls delete_branch on each of the siblings, which recursively calls delete_children on each of the blocks in the branch.

However, delete_children only deletes the block's children from the CryptoHash -> ChildrenList mapping in the "Block to Children" section of the BlockTree, but it doesn't delete the deleted child block data from the CryptoHash -> Block mapping in the "Blocks" section of the BlockTree.

Proposed fix: delete_children should also delete the block from the "Blocks" section