mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-14 19:25:51 +00:00
This does several things to support the ability to upgrade from a BlockChain to a FullPrunedBlockChain backed by the same FullPrunedBlockStore: * Add two methods to FullPrunedBlockStore to allow it to keep track of two chain heads - one verified, one normal. * Change preSetChainHead in AbstractBlockChain to doSetChainHead so that FullPrunedBlockChain and BlockChain can set only the appropriate chain head * Add FullPrunedBlockStore.getOnceUndoableStoredBlock. This allows a BlockChain to request only StoredBlocks which were, at one point, associated with a StoredUndoableBlock, effectively splitting FullPrunedBlockStore into two independent BlockStores (one FullPruned, one normal). * Add/use AbstractBlockChain.getStoredBlockInCurrentScope which relies on the above additions to FullPrunedBlockStore to properly utilize one FullPrunedBlockStore as two separate block stores depending on the BlockChain instance used. Note that this is not used everywhere in AbstractBlockChain as, barring something being insanely broken, the prev block of a block in current scope will be in current scope.