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):
log.debug("Abandon %s %s" % (claim_outpoint['txid'], claim_outpoint['nout']))
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
)
yield self._broadcast_claim_transaction(claim_out)
defer.returnValue()
claim_out = yield self._broadcast_claim_transaction(abandon_tx)
defer.returnValue(claim_out)
def _support_claim(self, 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
@defer.inlineCallbacks
def jsonrpc_get(
self, name, file_name=None, stream_info=None, timeout=None,
download_directory=None, wait_for_write=True):
def jsonrpc_get(self, name, file_name=None, stream_info=None, timeout=None,
download_directory=None, wait_for_write=True):
"""
Download stream from a LBRY name.
@ -1764,6 +1763,7 @@ class Daemon(AuthJSONRPCServer):
response = yield self._render_response(abandon_claim_tx)
except BaseException as err:
log.warning(err)
# pylint: disable=unsubscriptable-object
if len(err.args) and err.args[0] == "txid was not found in wallet":
raise Exception("This transaction was not found in your wallet")
else:

View file

@ -337,9 +337,10 @@ class AuthJSONRPCServer(AuthorizedBase):
@staticmethod
def _check_params(function, args_dict):
argspec = inspect.getargspec(undecorated(function))
num_optional_params = 0 if argspec.defaults is None else len(argspec.defaults)
missing_required_params = [
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 len(missing_required_params):