From 6c091acd34dd73f327ebda86075340f4c394acf6 Mon Sep 17 00:00:00 2001 From: 0Gitnick Date: Tue, 13 Aug 2019 15:18:43 -0500 Subject: [PATCH] Shorten hashMeetsDifficulty function --- onionr/onionrproofs.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/onionr/onionrproofs.py b/onionr/onionrproofs.py index 860da578..ede7b50d 100755 --- a/onionr/onionrproofs.py +++ b/onionr/onionrproofs.py @@ -63,19 +63,18 @@ def getHashDifficulty(hexHash): return difficulty -def hashMeetsDifficulty(h): +def hashMeetsDifficulty(hexHash): ''' Return bool for a hash string to see if it meets pow difficulty defined in config ''' - hashDifficulty = getHashDifficulty(h) + hashDifficulty = getHashDifficulty(hexHash) + try: expected = int(config.get('general.minimum_block_pow')) except TypeError: raise ValueError('Missing general.minimum_block_pow config') - if hashDifficulty >= expected: - return True - else: - return False + + return hashDifficulty >= expected class DataPOW: def __init__(self, data, forceDifficulty=0, threadCount = 1):