Compare commits

..

No commits in common. "12fa1a4e972681a6f0f9c6b527197fc8d925e87a" and "96e4fa20e4c6d261a2663439eeb0cfb777196506" have entirely different histories.

5 changed files with 8 additions and 19 deletions

3
.gitmodules vendored
View File

@ -10,6 +10,3 @@
[submodule "externals/quarkcoin-hash"]
path = externals/quarkcoin-hash
url = https://github.com/Neisklar/quarkcoin-hash-python
[submodule "externals/vertcoin_scrypt"]
path = externals/vertcoin_scrypt
url = https://github.com/scr34m/vertcoin_scrypt.git

@ -1 +0,0 @@
Subproject commit 4a3d789cf4fd713308f26610e39e81cb7d86423f

View File

@ -296,7 +296,7 @@ class CBlock(object):
self.quark = uint256_from_str(quark_hash.getPoWHash(''.join(r)))
return self.quark
elif settings.COINDAEMON_ALGO == 'scrypt-jane':
def calc_scryptjane(self):
def calc_acryptjane(self):
if self.scryptjane is None:
r = []
r.append(struct.pack("<i", self.nVersion))

View File

@ -6,7 +6,7 @@ import settings
if settings.COINDAEMON_ALGO == 'scrypt':
import ltc_scrypt
elif settings.COINDAEMON_ALGO == 'scrypt-jane':
scryptjane = __import__(settings.SCRYPTJANE_NAME)
import settings.SCRYPTJANE_NAME
elif settings.COINDAEMON_ALGO == 'quark':
import quark_hash
elif settings.COINDAEMON_ALGO == 'skeinhash':
@ -159,16 +159,12 @@ class TemplateRegistry(object):
return diff1 / difficulty
def get_job(self, job_id, worker_name, ip=False):
def get_job(self, job_id):
'''For given job_id returns BlockTemplate instance or None'''
try:
j = self.jobs[job_id]
except:
log.info("Job id '%s' not found, worker_name: '%s'" % (job_id, worker_name))
if ip:
log.info("Worker submited invalid Job id: IP %s", str(ip))
log.info("Job id '%s' not found" % job_id)
return None
# Now we have to check if job is still valid.
@ -185,7 +181,7 @@ class TemplateRegistry(object):
return j
def submit_share(self, job_id, worker_name, session, extranonce1_bin, extranonce2, ntime, nonce,
difficulty, ip=False):
difficulty):
'''Check parameters and finalize block template. If it leads
to valid block candidate, asynchronously submits the block
back to the bitcoin network.
@ -201,7 +197,7 @@ class TemplateRegistry(object):
raise SubmitException("Incorrect size of extranonce2. Expected %d chars" % (self.extranonce2_size*2))
# Check for job
job = self.get_job(job_id, worker_name, ip)
job = self.get_job(job_id)
if job == None:
raise SubmitException("Job '%s' not found" % job_id)
@ -245,10 +241,7 @@ class TemplateRegistry(object):
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 == 'scrypt-jane':
if settings.SCRYPTJANE_NAME == 'vtc_scrypt':
hash_bin = scryptjane.getPoWHash(''.join([ header_bin[i*4:i*4+4][::-1] for i in range(0, 20) ]))
else:
hash_bin = scryptjane.getPoWHash(''.join([ header_bin[i*4:i*4+4][::-1] for i in range(0, 20) ]), int(ntime, 16))
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':
hash_bin = quark_hash.getPoWHash(''.join([ header_bin[i*4:i*4+4][::-1] for i in range(0, 20) ]))
elif settings.COINDAEMON_ALGO == 'skeinhash':

View File

@ -169,7 +169,7 @@ class MiningService(GenericService):
# and it is valid proof of work.
try:
(block_header, block_hash, share_diff, on_submit) = Interfaces.template_registry.submit_share(job_id,
worker_name, session, extranonce1_bin, extranonce2, ntime, nonce, difficulty, ip)
worker_name, session, extranonce1_bin, extranonce2, ntime, nonce, difficulty)
except SubmitException as e:
# block_header and block_hash are None when submitted data are corrupted
invalid += 1