Fix difficultyModifier

master
0Gitnick 2019-08-13 14:51:46 -05:00
parent ae845940d9
commit 8a36144675
1 changed files with 4 additions and 12 deletions

View File

@ -22,23 +22,15 @@ import config, logger, onionrblockapi, storagecounter
from onionrutils import bytesconverter
from onionrcrypto import hashers
config.reload()
def getDifficultyModifier():
'''returns the difficulty modifier for block storage based
on a variety of factors, currently only disk use.
'''
retData = 0
useFunc = storagecounter.StorageCounter().getPercent
percentUse = storagecounter.StorageCounter().getPercent()
difficultyIncrease = math.floor(4 * percentUse)
percentUse = useFunc()
if percentUse >= 0.50:
retData += 1
elif percentUse >= 0.75:
retData += 2
elif percentUse >= 0.95:
retData += 3
return retData
return difficultyIncrease
def getDifficultyForNewBlock(data, ourBlock=True):
'''