Compare commits
10 Commits
96e4fa20e4
...
12fa1a4e97
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
12fa1a4e97 | ||
|
|
1ec817b248 | ||
|
|
4a68da7bcd | ||
|
|
5f8a1ff51d | ||
|
|
7e4f9cd58f | ||
|
|
67f74ff9ef | ||
|
|
56cd8940b1 | ||
|
|
5e5d6b9b14 | ||
|
|
73385d3f79 | ||
|
|
0d1e796517 |
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -10,3 +10,6 @@
|
||||
[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
externals/vertcoin_scrypt
vendored
Submodule
1
externals/vertcoin_scrypt
vendored
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 4a3d789cf4fd713308f26610e39e81cb7d86423f
|
||||
@ -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_acryptjane(self):
|
||||
def calc_scryptjane(self):
|
||||
if self.scryptjane is None:
|
||||
r = []
|
||||
r.append(struct.pack("<i", self.nVersion))
|
||||
|
||||
@ -6,7 +6,7 @@ import settings
|
||||
if settings.COINDAEMON_ALGO == 'scrypt':
|
||||
import ltc_scrypt
|
||||
elif settings.COINDAEMON_ALGO == 'scrypt-jane':
|
||||
import settings.SCRYPTJANE_NAME
|
||||
scryptjane = __import__(settings.SCRYPTJANE_NAME)
|
||||
elif settings.COINDAEMON_ALGO == 'quark':
|
||||
import quark_hash
|
||||
elif settings.COINDAEMON_ALGO == 'skeinhash':
|
||||
@ -159,12 +159,16 @@ class TemplateRegistry(object):
|
||||
|
||||
return diff1 / difficulty
|
||||
|
||||
def get_job(self, job_id):
|
||||
def get_job(self, job_id, worker_name, ip=False):
|
||||
'''For given job_id returns BlockTemplate instance or None'''
|
||||
try:
|
||||
j = self.jobs[job_id]
|
||||
except:
|
||||
log.info("Job id '%s' not found" % job_id)
|
||||
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))
|
||||
|
||||
return None
|
||||
|
||||
# Now we have to check if job is still valid.
|
||||
@ -181,7 +185,7 @@ class TemplateRegistry(object):
|
||||
return j
|
||||
|
||||
def submit_share(self, job_id, worker_name, session, extranonce1_bin, extranonce2, ntime, nonce,
|
||||
difficulty):
|
||||
difficulty, ip=False):
|
||||
'''Check parameters and finalize block template. If it leads
|
||||
to valid block candidate, asynchronously submits the block
|
||||
back to the bitcoin network.
|
||||
@ -197,7 +201,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)
|
||||
job = self.get_job(job_id, worker_name, ip)
|
||||
if job == None:
|
||||
raise SubmitException("Job '%s' not found" % job_id)
|
||||
|
||||
@ -241,7 +245,10 @@ 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':
|
||||
hash_bin = yac_scrypt.getPoWHash(''.join([ header_bin[i*4:i*4+4][::-1] for i in range(0, 20) ]), int(ntime, 16))
|
||||
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))
|
||||
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':
|
||||
|
||||
@ -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)
|
||||
worker_name, session, extranonce1_bin, extranonce2, ntime, nonce, difficulty, ip)
|
||||
except SubmitException as e:
|
||||
# block_header and block_hash are None when submitted data are corrupted
|
||||
invalid += 1
|
||||
|
||||
Loading…
Reference in New Issue
Block a user