fixes, refactors

This commit is contained in:
Alex Grintsvayg 2017-03-23 14:11:01 -04:00
parent b4364f661c
commit 0c42bc6382
3 changed files with 8 additions and 7 deletions

View file

@ -1033,11 +1033,11 @@ class LBRYumWallet(Wallet):
def _abandon_claim(self, claim_outpoint): def _abandon_claim(self, claim_outpoint):
log.debug("Abandon %s %s" % (claim_outpoint['txid'], claim_outpoint['nout'])) log.debug("Abandon %s %s" % (claim_outpoint['txid'], claim_outpoint['nout']))
broadcast = False broadcast = False
claim_out = yield self._run_cmd_as_defer_succeed( abandon_tx = yield self._run_cmd_as_defer_succeed(
'abandon', claim_outpoint['txid'], claim_outpoint['nout'], broadcast 'abandon', claim_outpoint['txid'], claim_outpoint['nout'], broadcast
) )
yield self._broadcast_claim_transaction(claim_out) claim_out = yield self._broadcast_claim_transaction(abandon_tx)
defer.returnValue() defer.returnValue(claim_out)
def _support_claim(self, name, claim_id, amount): def _support_claim(self, name, claim_id, amount):
log.debug("Support %s %s %f" % (name, claim_id, amount)) log.debug("Support %s %s %f" % (name, claim_id, amount))

View file

@ -1444,9 +1444,8 @@ class Daemon(AuthJSONRPCServer):
@AuthJSONRPCServer.auth_required @AuthJSONRPCServer.auth_required
@defer.inlineCallbacks @defer.inlineCallbacks
def jsonrpc_get( def jsonrpc_get(self, name, file_name=None, stream_info=None, timeout=None,
self, name, file_name=None, stream_info=None, timeout=None, download_directory=None, wait_for_write=True):
download_directory=None, wait_for_write=True):
""" """
Download stream from a LBRY name. Download stream from a LBRY name.
@ -1764,6 +1763,7 @@ class Daemon(AuthJSONRPCServer):
response = yield self._render_response(abandon_claim_tx) response = yield self._render_response(abandon_claim_tx)
except BaseException as err: except BaseException as err:
log.warning(err) log.warning(err)
# pylint: disable=unsubscriptable-object
if len(err.args) and err.args[0] == "txid was not found in wallet": if len(err.args) and err.args[0] == "txid was not found in wallet":
raise Exception("This transaction was not found in your wallet") raise Exception("This transaction was not found in your wallet")
else: else:

View file

@ -337,9 +337,10 @@ class AuthJSONRPCServer(AuthorizedBase):
@staticmethod @staticmethod
def _check_params(function, args_dict): def _check_params(function, args_dict):
argspec = inspect.getargspec(undecorated(function)) argspec = inspect.getargspec(undecorated(function))
num_optional_params = 0 if argspec.defaults is None else len(argspec.defaults)
missing_required_params = [ missing_required_params = [
required_param required_param
for required_param in argspec.args[1:-len(argspec.defaults or ())] for required_param in argspec.args[1:-num_optional_params]
if required_param not in args_dict if required_param not in args_dict
] ]
if len(missing_required_params): if len(missing_required_params):