Skip to content

Commit

Permalink
Fixed Diff1, Added Header for coins that need it
Browse files Browse the repository at this point in the history
  • Loading branch information
CryptoExpert committed Feb 7, 2017
1 parent f1f3ec9 commit e2ea82e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions conf/config_sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
ALGO_NAME = 'lyra2re2_hash' # Name of module implementing getPoWHash
COINDAEMON_TX = False # For Coins which support TX Messages please enter yes in the TX selection
COINDAEMON_HAS_SEGWIT = False
#CUSTOM_HEADER = "000000800000000000000000000000000000000000000000000000000000000000000000000000000000000080020000"
#CUSTOM_DIFF1 = 0x0000ffff00000000000000000000000000000000000000000000000000000000 # Scrypt
#COINDAEMON_REWARD = 'POW' If it needs to be overridden i believe
# ******************** BASIC SETTINGS ***************
Expand Down
5 changes: 4 additions & 1 deletion lib/template_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ def _update_block(self, data):

def diff_to_target(self, difficulty):
'''Converts difficulty to target'''
diff1 = 0x00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff

diff1 = 0x00000000ffff0000000000000000000000000000000000000000000000000000
if settings.CUSTOM_DIFF1 != None:
diff1 = settings.CUSTOM_DIFF1
return diff1 / difficulty
Expand Down Expand Up @@ -250,6 +251,8 @@ def submit_share(self, job_id, worker_name, session, extranonce1_bin, extranonce
hash_int = util.uint256_from_str(hash_bin)
scrypt_hash_hex = "%064x" % hash_int
header_hex = binascii.hexlify(header_bin)
if settings.CUSTOM_HEADER != None:
header_hex = header_hex+ settings.CUSTOM_HEADER

target_user = self.diff_to_target(difficulty)
if hash_int > target_user:
Expand Down

0 comments on commit e2ea82e

Please sign in to comment.