slush0 / stratum

Stratum server implementation using Python Twisted

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Subscribe() takes exactly 1 argument (2 given)

bandroidx opened this issue · comments

I get this error on several different setups of Stratum in various miners every time a user joins the pool:

2013-04-10 07:20:16,353 ERROR protocol # [Failure instance: Traceback: <type 'exceptions.TypeError'>: subscribe() takes exactly 1 argument (2 given)
/opt/stratum/stratum/stratum/protocol.py:192:dataReceived
/opt/stratum/stratum/stratum/protocol.py:238:lineReceived
/opt/stratum/stratum/stratum/services.py:13:_handle_event
/opt/stratum/stratum/stratum/services.py:81:call
--- ---
/usr/lib/python2.7/dist-packages/twisted/internet/defer.py:134:maybeDeferred
/opt/stratum/stratum/stratum/services.py:78:_run
]
None

Are you trying to setup your own pool?

correct

The error happens for me even in bitcoin mode with the demo mining pool

I am having the same error as bandroidx. Has there been any developments on this/is there a workaround?

To get around this issue I did the following:

In protocol.py, after the following code:
msg_id = message.get('id', 0)
msg_method = message.get('method')
msg_params = message.get('params')
msg_result = message.get('result')
msg_error = message.get('error')

I added:
if msg_method == "mining.subscribe":
del msg_params[0:len(msg_params)]

This has resolved the error, and everything still seems to be mining fine. Is their any issues you can see with this? Any problems which may be caused which I haven't seen?

Thanks

Thanks dshiells that worked for me!

Thanks tylerburleigh!

As I mentioned it seems a bit of a hack though, so hoping for a response from slush to see it won't affect something down the line. I have posted here and in the relevant bitcointalk.org forum.

Glad it seems to work for you too though...

Seems that this "extra" parameter is just a user agent string sent by the client.
A better "hack" could be to add the additional parameter in the subscribe method in mining/service.py:

def subscribe(self, useragent):
log.info("Subscribed: %s" % str(useragent))

Actually this is bug of stratum-mining service, not in stratum library. I just fixed it in this commit: slush0/stratum-mining@8a7474e

I have the same problem in stratum-mining-proxy...