Permalink
Browse files

added MED support

  • Loading branch information...
mrtexaznl committed Jan 17, 2014
1 parent f2185b9 commit 0752339caf6335b4e16dc9b0e79581ea0861bfc4
Showing with 6 additions and 2 deletions.
  1. +6 −2 lib/template_registry.py
View
@@ -9,6 +9,8 @@
import yac_scrypt
elif settings.COINDAEMON_ALGO == 'quark':
import quark_hash
elif settings.COINDAEMON_ALGO == 'hybridsch256':
import medcoin_hybrid
else: pass
from twisted.internet import defer
from lib.exceptions import SubmitException
@@ -148,7 +150,7 @@ def _update_block(self, data):
def diff_to_target(self, difficulty):
'''Converts difficulty to target'''
if settings.COINDAEMON_ALGO == 'scrypt' or 'scrypt-jane':
if settings.COINDAEMON_ALGO == 'scrypt' or settings.COINDAEMON_ALGO == 'scrypt-jane' or settings.COINDAEMON_ALGO == 'hybridsch256':
diff1 = 0x0000ffff00000000000000000000000000000000000000000000000000000000
elif settings.COINDAEMON_ALGO == 'quark':
diff1 = 0x000000ffff000000000000000000000000000000000000000000000000000000
@@ -236,6 +238,8 @@ def submit_share(self, job_id, worker_name, session, extranonce1_bin, extranonce
# 4. Reverse header and compare it with target of the user
if settings.COINDAEMON_ALGO == 'scrypt':
hash_bin = ltc_scrypt.getPoWHash(''.join([ header_bin[i*4:i*4+4][::-1] for i in range(0, 20) ]))
elif settings.COINDAEMON_ALGO == 'hybridsch256':
hash_bin = medcoin_hybrid.getPoWHash(''.join([ header_bin[i*4:i*4+4][::-1] for i in range(0, 20) ]))
elif settings.COINDAEMON_ALGO == 'scrypt-jane':
hash_bin = yac_scrypt.getPoWHash(''.join([ header_bin[i*4:i*4+4][::-1] for i in range(0, 20) ]), int(ntime, 16))
elif settings.COINDAEMON_ALGO == 'quark':
@@ -244,7 +248,7 @@ 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.COINDAEMON_ALGO == 'scrypt' or settings.COINDAEMON_ALGO == 'scrypt-jane':
if settings.COINDAEMON_ALGO == 'scrypt' or settings.COINDAEMON_ALGO == 'scrypt-jane' or settings.COINDAEMON_ALGO == 'hybridsch256':
header_hex = header_hex+"000000800000000000000000000000000000000000000000000000000000000000000000000000000000000080020000"
elif settings.COINDAEMON_ALGO == 'quark':
header_hex = header_hex+"000000800000000000000000000000000000000000000000000000000000000000000000000000000000000080020000"

0 comments on commit 0752339

Please sign in to comment.