Skip to content

Commit

Permalink
Abstract LookupWork
Browse files Browse the repository at this point in the history
  • Loading branch information
luke-jr committed Jun 13, 2016
1 parent 8656cbd commit a5e02f2
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions eloipool.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,14 @@ def IsJobValid(wli, wluser = None):
return False
return True

def LookupWork(username, wli):
if username not in workLog:
raise RejectedShare('unknown-user')
MWL = workLog[username]
if wli not in MWL:
raise RejectedShare('unknown-work')
return MWL[wli]

def checkShare(share):
shareTime = share['time'] = time()

Expand All @@ -487,10 +495,6 @@ def checkShare(share):
checkData(share)
data = share['data']

if username not in workLog:
raise RejectedShare('unknown-user')
MWL = workLog[username]

shareMerkleRoot = data[36:68]
if 'blkdata' in share:
pl = share['blkdata']
Expand All @@ -508,22 +512,18 @@ def checkShare(share):
mode = 'MRD'
moden = 0
coinbase = None

(wld, issueT) = LookupWork(username, wli)
else:
# Stratum
checkQuickDiffAdjustment = config.DynamicTargetQuick
wli = share['jobid']
(wld, issueT) = LookupWork(None, wli)
buildStratumData(share, b'\0' * 32)
mode = 'MC'
moden = 1
othertxndata = b''
if None not in workLog:
# We haven't yet sent any stratum work for this block
raise RejectedShare('unknown-work')
MWL = workLog[None]

if wli not in MWL:
raise RejectedShare('unknown-work')
(wld, issueT) = MWL[wli]
share[mode] = wld

share['issuetime'] = issueT
Expand Down

0 comments on commit a5e02f2

Please sign in to comment.