mirror of
https://gitee.com/BTAJL/repchain.git
synced 2024-11-30 02:38:24 +08:00
repchain2.0-update36:修改系统启动时存储检查问题,增加区块文件只有一个区块的处理逻辑。
This commit is contained in:
parent
4d45295425
commit
99d559fd17
@ -184,12 +184,12 @@ system {
|
||||
storage {
|
||||
db_type = "LevelDB" #支持数据库的类型:LevelDB、RocksDB
|
||||
db_path = "./repchaindata/data/leveldbdata"
|
||||
db_name = "044934755127708189.node7"#"12110107bi45jh675g.node2"
|
||||
db_name = "12110107bi45jh675g.node2"
|
||||
db_cache_size=48 #数据库读写缓存,单位为M
|
||||
|
||||
block_file_type = "localFileSystem"
|
||||
block_file_path = "./repchaindata/data/blockdata"
|
||||
block_file_name = "044934755127708189.node7"#"12110107bi45jh675g.node2"
|
||||
block_file_name = "12110107bi45jh675g.node2"
|
||||
file_max_length = 100 #单位为M
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ class verify4Storage(ctx:RepChainSystemContext) {
|
||||
val first = sr.getBlockHeightInFileFirstBlockByFileNo(i).get
|
||||
var last = blockHeight
|
||||
if(i < fno){
|
||||
last = sr.getBlockHeightInFileFirstBlockByFileNo(i+1).get
|
||||
last = sr.getBlockHeightInFileFirstBlockByFileNo(i+1).get - 1
|
||||
}
|
||||
fls(i) = (i,first,last)
|
||||
i += 1
|
||||
@ -49,19 +49,27 @@ class verify4Storage(ctx:RepChainSystemContext) {
|
||||
|
||||
private def verfiyFileForFileInfo(firstHeigh:Long,lastHeight:Long,sr: BlockSearcher):Boolean={
|
||||
var r = true
|
||||
val seed = lastHeight-firstHeigh
|
||||
breakable(
|
||||
for(i<-0 to 9){
|
||||
val rseed = Random.nextLong()
|
||||
var h = Math.abs(rseed) % seed + firstHeigh
|
||||
if(!verfiyBlockOfFile(h,sr)){
|
||||
r = false
|
||||
break
|
||||
}else{
|
||||
RepLogger.info(RepLogger.System_Logger, s"自检:verfiyBlockOfFile成功,检查高度=${h}")
|
||||
}
|
||||
})
|
||||
r
|
||||
if(lastHeight == firstHeigh){
|
||||
if(!verfiyBlockOfFile(firstHeigh,sr)){
|
||||
r = false
|
||||
}else{
|
||||
RepLogger.info(RepLogger.System_Logger, s"自检:verfiyBlockOfFile成功,检查高度=${firstHeigh}")
|
||||
}
|
||||
}else{
|
||||
val seed = lastHeight-firstHeigh
|
||||
breakable(
|
||||
for(i<-0 to 9){
|
||||
val rseed = Random.nextLong()
|
||||
var h = Math.abs(rseed) % seed + firstHeigh
|
||||
if(!verfiyBlockOfFile(h,sr)){
|
||||
r = false
|
||||
break
|
||||
}else{
|
||||
RepLogger.info(RepLogger.System_Logger, s"自检:verfiyBlockOfFile成功,检查高度=${h}")
|
||||
}
|
||||
})
|
||||
}
|
||||
r
|
||||
}
|
||||
|
||||
private def verfiyBlockOfFile(height:Long,sr: BlockSearcher):Boolean={
|
||||
|
Loading…
Reference in New Issue
Block a user