Fix difficultyModifier

This commit is contained in:
0Gitnick 2019-08-13 14:51:46 -05:00
parent ae845940d9
commit 8a36144675

View File

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