Skip to content

Commit

Permalink
Merge branch 'stratum_quickupdate'
Browse files Browse the repository at this point in the history
  • Loading branch information
luke-jr committed May 22, 2015
2 parents 97b1beb + 98d1a66 commit 32f1cfd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 3 additions & 0 deletions config.py.example
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ DynamicTargetGoal = 8
# Number of seconds hashrate is measured over
DynamicTargetWindow = 120

# Should we try to adjust the target quickly when there are a lot of shares?
DynamicTargetQuick = True

# Minimum and maximum of merkle roots to keep queued
WorkQueueSizeRegular = (0x100, 0x1000)

Expand Down
9 changes: 6 additions & 3 deletions eloipool.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,13 @@ def WorkLogPruner(wl):

if not hasattr(config, 'DynamicTargetting'):
config.DynamicTargetting = 0
config.DynamicTargetQuick = False
else:
if not hasattr(config, 'DynamicTargetWindow'):
config.DynamicTargetWindow = 120
config.DynamicTargetGoal *= config.DynamicTargetWindow / 60
if not hasattr(config, 'DynamicTargetQuick'):
config.DynamicTargetQuick = True

def submitGotwork(info):
try:
Expand Down Expand Up @@ -478,7 +481,7 @@ def checkShare(share):
shareTime = share['time'] = time()

username = share['username']
isstratum = False
checkQuickDiffAdjustment = False
if 'data' in share:
# getwork/GBT
checkData(share)
Expand Down Expand Up @@ -507,7 +510,7 @@ def checkShare(share):
coinbase = None
else:
# Stratum
isstratum = True
checkQuickDiffAdjustment = config.DynamicTargetQuick
wli = share['jobid']
buildStratumData(share, b'\0' * 32)
mode = 'MC'
Expand Down Expand Up @@ -650,7 +653,7 @@ def checkShare(share):
userStatus[username][2] += 1
else:
userStatus[username][2] += float(target) / workTarget
if isstratum and userStatus[username][2] > config.DynamicTargetGoal * 2:
if checkQuickDiffAdjustment and userStatus[username][2] > config.DynamicTargetGoal * 2:
stratumsrv.quickDifficultyUpdate(username)
checkShare.logger = logging.getLogger('checkShare')

Expand Down

0 comments on commit 32f1cfd

Please sign in to comment.