Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Don't exit on wrong username/password. Keep trying with the other servers #26

Open
wants to merge 2 commits into from

3 participants

@clopez

Don't exit on wrong username/password. Keep trying with the other servers.

Issue #25

@clopez

Probably it won't hurt to include also a sleep(1)
Just in case all username/password(s) are wrong, the sleep will prevent it from looping very fast and burn lots of cpu cycles.

Please merge also 0e557a1

The previous was broken and the former one is cleaner

@clopez

Please merge also 0e557a1

The previous was broken and the former one is cleaner

@m0mchil
Owner

Thank you. Currently I can't decide if it is OK to not fail on bad credentials. If you can communicate with a pool but it rejects your password this perhaps should just be corrected or the server removed from the list?

@gominoa

I dont think failing to shell is good. Many miners may only be checked once a day. It should continue to do something useful. I think report the error and move on to next server is best. I could see someone starting the miner first then adding a new worker to pool. Or modifying credentials on pool before updating miners. Miner should always be doing something useful if possible.

@gominoa

How about bail out if only one server specified. Otherwise switch to backup.
Not sure what to do if both are NotAuth. Maybe add a counter and bail out if all servers fail?

@clopez

I also think that failing to shell is always the worst option of all.

Most of miners are not human-checked more than once a day.

And it's a pity that your mine stopped working because of any error.

Actually as a workaround I wrap the execution of poclbm in a bash script that ensures that it will never end

while true; do
./poclbm [....]
sleep 60
done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 10 additions and 4 deletions.
  1. +10 −4 BitcoinMiner.py
View
14 BitcoinMiner.py
@@ -255,18 +255,24 @@ def getwork(self, data=None):
self.failback_getwork_count = 0
self.failback_attempt_count = 0
return result['result']
- except NotAuthorized:
- self.failure('Wrong username or password')
except RPCError as e:
self.say('%s', e)
- except (IOError, httplib.HTTPException, ValueError):
+ except (IOError, httplib.HTTPException, ValueError, NotAuthorized) as e:
if save_pool:
self.failback_attempt_count += 1
self.setpool(save_pool)
self.sayLine('Still unable to reconnect to primary pool (attempt %s), failing over', self.failback_attempt_count)
self.failback_getwork_count = 0
return
- self.say('Problems communicating with bitcoin RPC %s %s', (self.errors, self.options.tolerance))
+
+ self.say('%s %s %s', (
+ if_else((type(e).__name__ == "NotAuthorized"),
+ 'Wrong username or password',
+ 'Problems communicating with bitcoin RPC'),
+ self.errors,
+ self.options.tolerance)
+ )
+
self.errors += 1
if self.errors > self.options.tolerance+1:
self.errors = 0
Something went wrong with that request. Please try again.