Shorten hashMeetsDifficulty function
This commit is contained in:
parent
401723f5ab
commit
6c091acd34
@ -63,19 +63,18 @@ def getHashDifficulty(hexHash):
|
|||||||
|
|
||||||
return difficulty
|
return difficulty
|
||||||
|
|
||||||
def hashMeetsDifficulty(h):
|
def hashMeetsDifficulty(hexHash):
|
||||||
'''
|
'''
|
||||||
Return bool for a hash string to see if it meets pow difficulty defined in config
|
Return bool for a hash string to see if it meets pow difficulty defined in config
|
||||||
'''
|
'''
|
||||||
hashDifficulty = getHashDifficulty(h)
|
hashDifficulty = getHashDifficulty(hexHash)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
expected = int(config.get('general.minimum_block_pow'))
|
expected = int(config.get('general.minimum_block_pow'))
|
||||||
except TypeError:
|
except TypeError:
|
||||||
raise ValueError('Missing general.minimum_block_pow config')
|
raise ValueError('Missing general.minimum_block_pow config')
|
||||||
if hashDifficulty >= expected:
|
|
||||||
return True
|
return hashDifficulty >= expected
|
||||||
else:
|
|
||||||
return False
|
|
||||||
|
|
||||||
class DataPOW:
|
class DataPOW:
|
||||||
def __init__(self, data, forceDifficulty=0, threadCount = 1):
|
def __init__(self, data, forceDifficulty=0, threadCount = 1):
|
||||||
|
Loading…
Reference in New Issue
Block a user