Bitcoin Forum
April 23, 2018, 04:02:15 AM *
News: Latest stable version of Bitcoin Core: 0.16.0  [Torrent]. (New!)
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: subscribe() takes exactly 1 argument (2 given) - Possible solution?!?  (Read 1146 times)
fuzzster
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
1524456135
Hero Member
*
Offline Offline

Posts: 1524456135

View Profile Personal Message (Offline)

Ignore
1524456135
Reply with quote  #2

1524456135
Report to moderator
1524456135
Hero Member
*
Offline Offline

Posts: 1524456135

View Profile Personal Message (Offline)

Ignore
1524456135
Reply with quote  #2

1524456135
Report to moderator
1524456135
Hero Member
*
Offline Offline

Posts: 1524456135

View Profile Personal Message (Offline)

Ignore
1524456135
Reply with quote  #2

1524456135
Report to moderator
There are several different types of Bitcoin clients. The most secure are full nodes like Bitcoin Core, but full nodes are more resource-heavy, and they must do a lengthy initial syncing process. As a result, lightweight clients with somewhat less security are commonly used.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1524456135
Hero Member
*
Offline Offline

Posts: 1524456135

View Profile Personal Message (Offline)

Ignore
1524456135
Reply with quote  #2

1524456135
Report to moderator
1524456135
Hero Member
*
Offline Offline

Posts: 1524456135

View Profile Personal Message (Offline)

Ignore
1524456135
Reply with quote  #2

1524456135
Report to moderator
1524456135
Hero Member
*
Offline Offline

Posts: 1524456135

View Profile Personal Message (Offline)

Ignore
1524456135
Reply with quote  #2

1524456135
Report to moderator
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:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!