Compare commits

...

10 Commits

Author SHA1 Message Date
ahmedbodi
12fa1a4e97 Merge pull request #266 from Fredyy90/NScrypt
added IP to invalid "job id" log entry
2014-02-19 15:27:55 +00:00
Frederick Behrends
1ec817b248 added IP to invalid "job id" log entry 2014-02-19 14:47:20 +01:00
ahmedbodi
4a68da7bcd Merge pull request #252 from ktbken/NScrypt
Calculation Typo
2014-02-14 00:51:59 +00:00
Ken
5f8a1ff51d fix typo 2014-02-13 20:00:35 +00:00
Ken
7e4f9cd58f Revert "Another try"
This reverts commit 67f74ff9ef.
2014-02-13 07:21:05 +00:00
Ken
67f74ff9ef Another try 2014-02-13 06:51:32 +00:00
Ken
56cd8940b1 Added vert module 2014-02-13 06:41:55 +00:00
Ken
5e5d6b9b14 fix syntax errors 2014-02-13 06:18:28 +00:00
ahmedbodi
73385d3f79 Scrypt Jane 2014-02-05 17:02:10 +00:00
ahmedbodi
0d1e796517 Scrypt Jane 2014-02-02 22:28:56 +00:00
5 changed files with 19 additions and 8 deletions

3
.gitmodules vendored
View File

@ -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

@ -0,0 +1 @@
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_acryptjane(self):
def calc_scryptjane(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':
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':

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)
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