Bitcoin Forum
November 10, 2024, 02:11:29 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: subscribe() takes exactly 1 argument (2 given) - Possible solution?!?  (Read 1214 times)
fuzzster (OP)
Newbie
*
Offline Offline

Activity: 19
Merit: 0


View Profile
May 23, 2013, 01:08:06 PM
 #1

I have a Stratum server with generalfaults stratum-mining installed, and have been getting the following error whenever someone connects their miner:
Code:
2013-05-23 08:29:18+0000 [Protocol,0,141.0.48.3] 
2013-05-23 08:29:18,619 ERROR protocol # [Failure instance: Traceback: <type 'exceptions.TypeError'>: subscribe() takes exactly 1 argument (2 given)
/usr/local/lib/python2.7/dist-packages/stratum-0.2.13-py2.7.egg/stratum/protocol.py:192:dataReceived
/usr/local/lib/python2.7/dist-packages/stratum-0.2.13-py2.7.egg/stratum/protocol.py:246:lineReceived
/usr/local/lib/python2.7/dist-packages/stratum-0.2.13-py2.7.egg/stratum/services.py:13:_handle_event
/usr/local/lib/python2.7/dist-packages/stratum-0.2.13-py2.7.egg/stratum/services.py:81:call
--- <exception caught here> ---
/usr/local/lib/python2.7/dist-packages/Twisted-13.0.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py:137:maybeDeferred
/usr/local/lib/python2.7/dist-packages/stratum-0.2.13-py2.7.egg/stratum/services.py:78:_run

Although the mining seems to continue fine, it was a massive annoyance, without mentioning the additional logging mess it made. After much digging, the culprit turns out to be when the mining.subscribe method is called from protocol.py, Stratum didn't like the additional parameter being used (in my case CGMiner/3.1.0 or something similar) in msg_params.

As such, I have created a work around by adding some code directly after the following lines in protocol.py:
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')

The code being:
Code:
if msg_method == "mining.subscribe":
    del msg_params[0:len(msg_params)]

This removes the error and everything SEEMS to be mining OK, however I was wondering peoples thoughts on it as it was just a hack. Could it effect anything down the line?

Unfortunately my Python is very poor, so please be nice with your comments  Smiley
kheops
Newbie
*
Offline Offline

Activity: 4
Merit: 0


View Profile
September 15, 2013, 02:22:02 PM
 #2

I got the same error and used your hack to make it "disappear". Did you get any more detail on this issue? I am using the latest stratum/stratum-mining and latest stable cgminer.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!