feat(node): add method to fix missing blocks in storage
Fix #2102
TODO: check if this method persists the data request (for dataRequestReport command)
TODO: check if this method persists the data request (for dataRequestReport command)
It does not, so that's missing: persist data request report
@tmpolaczyk what should we do with this?
So I took a look at this issue because I have been affected again, but this time it was only the transactions from the block that were missing, not the block. The missing transaction hash is 02bfa7550c30380f667dff1f51061ad0cf091f54c96e602fb78545e6d81f6b3f and the block hash is c92daffc61cc67b471b82804a9b01d6bbaf16a8a47546c7fe7e1dfa6abdbfa99 which is from 2022-07-01, so most probably the issue is still present in the master branch.
The approach presented in this draft, which consists of iterating over all the blocks and checking that they exist in the storage, does not work in the case above. We would need to iterate over all the transactions as well, and that would make this much slower.
Therefore I think it is better to use the another solution to fix this problem. In the past I used the rewind method and that fixes the missing block case, but it is slow. It currently does not work in the missing transaction case but that can be easily fixed by always writing all the transactions again. This also solves the "TODO: persist data request report" from this draft.
So improving the rewind method would be a better workaround, I will look into that.