Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Persistence : fix hang when SP watermark cannot be located
The methodology for loading persistence relies on walking backwards through persistence files until either a) we run out of persistence files or b) we run out of blocks. This is done via a while loop, but the while is based on persistedBlocks.size() which is only changed if persistedBlocks.find() is successful in locating the block. Thus if persistedBlocks.find() is unsuccesful (for example in the case of failed persistence loads) then the while loop will keep iterating - subtracting a block from curTip and trying to load state from persistence files again - over and over all the way back to the genesis block. This manifests in an apparently hung client. This commit adds an exit from the while after MAX_STATE_HISTORY+1 load attempts to prevent the issue.
- Loading branch information