def getwork(bitcoind):
try:
work = yield bitcoind.rpc_getmemorypool()
- except jsonrpc.Error, e:
- if e.code == -32601: # Method not found
- print >>sys.stderr, 'Error: Bitcoin version too old! Upgrade to v0.5 or newer!'
- raise deferral.RetrySilentlyException()
- raise
+ except jsonrpc.Error_for_code(-32601): # Method not found
+ print >>sys.stderr, 'Error: Bitcoin version too old! Upgrade to v0.5 or newer!'
+ raise deferral.RetrySilentlyException()
packed_transactions = [x.decode('hex') for x in work['transactions']]
if 'height' not in work:
work['height'] = (yield bitcoind.rpc_getblock(work['previousblockhash']))['height'] + 1