Verify SHA matches for network file

This commit is contained in:
Andrew Grant committed 2021-01-08 04:40:41 -05:00
1 parent edf2685faf
commit f2c93edcb4
1 file changed
+14 -1
+14 -1
View File
@@ -258,11 +258,24 @@ def getEngine(data, engine, network):
shutil.rmtree('tmp')
def getNetworkWeights(server, network):
if not network: return
if not network:
return
print ('Fetching and Verifying Network ({0})'.format(network))
fname = pathjoin('Networks', network).rstrip('/')
if not os.path.isfile(fname):
getFile('{}/networks/download/{}'.format(server, network), fname)
with open(fname, 'rb') as weights:
sha256 = hashlib.sha256(weights.read()).hexdigest()[:8].upper()
if sha256 != network:
os.remove(fname)
raise Exception('Unable to verify Network Weights')
print ('')
def getCutechessCommand(arguments, data, nps):
# Parse options for Dev