VeriBlock / alt-integration-cpp

Libraries for leveraging VeriBlock Proof-Of-Proof blockchain technology.
https://veriblock.github.io/alt-integration-cpp/
Other
6 stars 6 forks source link

AltBlockTree::removeSubtree is supposed to remove entire subtree from PayloadsIndex #901

Closed Warchant closed 2 years ago

Warchant commented 2 years ago

AltBlockTree::removeSubtree removes "toRemove" block from Block Index. But should remove entire subtree.

https://github.com/VeriBlock/alt-integration-cpp/blob/master/src/pop/blockchain/alt_block_tree.cpp#L702-L706

Warchant commented 2 years ago

Proposed solution is to add new argument in BaseBlockTree::removeSubtree - a function that accepts a BlockIndex "just before removal" so that we can clear all side effects.

OR

To add new virtual function in BaseBlockTree: "void onBlockRemove(index_t& index)" which is then overwritten in AltBlockTree and VbkBlockTree