File tree Expand file tree Collapse file tree 2 files changed +4
-3
lines changed
src/main/scala/io/iohk/ethereum Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -567,13 +567,14 @@ class FastSync(
567
567
568
568
// TODO [ETCM-676]: Move to blockchain and make sure it's atomic
569
569
private def discardLastBlocks (startBlock : BigInt , blocksToDiscard : Int ): Unit = {
570
+ // TODO (maybe ETCM-77): Manage last checkpoint number too
571
+ appStateStorage.putBestBlockNumber((startBlock - blocksToDiscard - 1 ).max(0 )).commit()
572
+
570
573
(startBlock to ((startBlock - blocksToDiscard).max(1 )) by - 1 ).foreach { n =>
571
574
blockchainReader.getBlockHeaderByNumber(n).foreach { headerToRemove =>
572
575
blockchain.removeBlock(headerToRemove.hash, withState = false )
573
576
}
574
577
}
575
- // TODO (maybe ETCM-77): Manage last checkpoint number too
576
- appStateStorage.putBestBlockNumber((startBlock - blocksToDiscard - 1 ).max(0 )).commit()
577
578
}
578
579
579
580
private def validateHeader (header : BlockHeader , peer : Peer ): Either [HeaderProcessingResult , BlockHeader ] = {
Original file line number Diff line number Diff line change @@ -126,7 +126,7 @@ class BlockchainReader(
126
126
127
127
/** Returns a block hash given a block number
128
128
*
129
- * @param number Number of the searchead block
129
+ * @param number Number of the searched block
130
130
* @return Block hash if found
131
131
*/
132
132
private def getHashByBlockNumber (number : BigInt ): Option [ByteString ] =
You can’t perform that action at this time.
0 commit comments