mirror of
https://gitee.com/BTAJL/repchain.git
synced 2024-11-29 18:28:27 +08:00
fix: 修复自检错误(某个区块文件可能不包含某个业务链的block)
This commit is contained in:
parent
13cb65414e
commit
24b57d4824
@ -36,13 +36,19 @@ class verify4Storage(ctx:RepChainSystemContext) {
|
|||||||
val fls = new Array[(Int,Long,Long)](fno+1)
|
val fls = new Array[(Int,Long,Long)](fno+1)
|
||||||
var i : Int = 0
|
var i : Int = 0
|
||||||
while(i <= fno){
|
while(i <= fno){
|
||||||
val first = sr.getBlockHeightInFileFirstBlockByFileNo(i).get
|
val fileNo = sr.getBlockHeightInFileFirstBlockByFileNo(i)
|
||||||
var last = blockHeight
|
if (fileNo.isDefined) {
|
||||||
if(i < fno){
|
val first = sr.getBlockHeightInFileFirstBlockByFileNo(i).get
|
||||||
last = sr.getBlockHeightInFileFirstBlockByFileNo(i+1).get - 1
|
var last = blockHeight
|
||||||
|
if (i < fno) {
|
||||||
|
last = sr.getBlockHeightInFileFirstBlockByFileNo(i + 1).get - 1
|
||||||
|
}
|
||||||
|
fls(i) = (i, first, last)
|
||||||
|
i += 1
|
||||||
|
} else {
|
||||||
|
fls(i) = (i, 0, 0)
|
||||||
|
i += 1
|
||||||
}
|
}
|
||||||
fls(i) = (i,first,last)
|
|
||||||
i += 1
|
|
||||||
}
|
}
|
||||||
fls.toSet
|
fls.toSet
|
||||||
}
|
}
|
||||||
@ -50,10 +56,12 @@ class verify4Storage(ctx:RepChainSystemContext) {
|
|||||||
private def verfiyFileForFileInfo(firstHeigh:Long,lastHeight:Long,sr: BlockSearcher):Boolean={
|
private def verfiyFileForFileInfo(firstHeigh:Long,lastHeight:Long,sr: BlockSearcher):Boolean={
|
||||||
var r = true
|
var r = true
|
||||||
if(lastHeight == firstHeigh){
|
if(lastHeight == firstHeigh){
|
||||||
if(!verfiyBlockOfFile(firstHeigh,sr)){
|
if (firstHeigh != 0) {
|
||||||
r = false
|
if (!verfiyBlockOfFile(firstHeigh, sr)) {
|
||||||
}else{
|
r = false
|
||||||
RepLogger.info(RepLogger.System_Logger, s"自检:verfiyBlockOfFile成功,检查高度=${firstHeigh}")
|
} else {
|
||||||
|
RepLogger.info(RepLogger.System_Logger, s"自检:verfiyBlockOfFile成功,检查高度=${firstHeigh}")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
val seed = lastHeight-firstHeigh
|
val seed = lastHeight-firstHeigh
|
||||||
|
Loading…
Reference in New Issue
Block a user