Slightly safer testnet reset detection
This commit is contained in:
parent
98656377a3
commit
6ae4070d3f
|
@ -66,10 +66,15 @@ cli do (testnetName {.argument.}: string):
|
|||
depositContractOpt = "--deposit-contract=" & readFile(depositContractFile).strip
|
||||
|
||||
if system.dirExists(dataDir):
|
||||
block resetDataDir:
|
||||
# We reset the testnet data dir if the existing data dir is
|
||||
# incomplete (it misses a genesis file) or if it has a genesis
|
||||
# file from an older testnet:
|
||||
if system.fileExists(dataDir/genesisFile):
|
||||
let localGenesisContent = readFile(dataDir/genesisFile)
|
||||
let testnetGenesisContent = readFile(testnetDir/genesisFile)
|
||||
if localGenesisContent != testnetGenesisContent:
|
||||
if localGenesisContent == testnetGenesisContent:
|
||||
break
|
||||
echo "Detected testnet restart. Deleting previous database..."
|
||||
rmDir dataDir
|
||||
|
||||
|
|
Loading…
Reference in New Issue