fix: 修复自检错误(某个区块文件可能不包含某个业务链的block)

This commit is contained in:
brightestBoy 2023-12-07 15:42:00 +08:00
parent 13cb65414e
commit 24b57d4824

View File

@ -36,6 +36,8 @@ class verify4Storage(ctx:RepChainSystemContext) {
val fls = new Array[(Int,Long,Long)](fno+1)
var i : Int = 0
while(i <= fno){
val fileNo = sr.getBlockHeightInFileFirstBlockByFileNo(i)
if (fileNo.isDefined) {
val first = sr.getBlockHeightInFileFirstBlockByFileNo(i).get
var last = blockHeight
if (i < fno) {
@ -43,6 +45,10 @@ class verify4Storage(ctx:RepChainSystemContext) {
}
fls(i) = (i, first, last)
i += 1
} else {
fls(i) = (i, 0, 0)
i += 1
}
}
fls.toSet
}
@ -50,11 +56,13 @@ class verify4Storage(ctx:RepChainSystemContext) {
private def verfiyFileForFileInfo(firstHeigh:Long,lastHeight:Long,sr: BlockSearcher):Boolean={
var r = true
if(lastHeight == firstHeigh){
if (firstHeigh != 0) {
if (!verfiyBlockOfFile(firstHeigh, sr)) {
r = false
} else {
RepLogger.info(RepLogger.System_Logger, s"自检verfiyBlockOfFile成功检查高度=${firstHeigh}")
}
}
}else{
val seed = lastHeight-firstHeigh
breakable(