fix get_history in lbrycrdwallet

This commit is contained in:
Jack 2016-08-18 22:15:49 -04:00
parent f6473e3383
commit 929db15214

View file

@ -489,6 +489,10 @@ class LBRYWallet(object):
d.addCallback(self._get_decoded_tx) d.addCallback(self._get_decoded_tx)
return d return d
def get_history(self):
d = self._get_history()
return d
def get_name_and_validity_for_sd_hash(self, sd_hash): def get_name_and_validity_for_sd_hash(self, sd_hash):
d = self._get_claim_metadata_for_sd_hash(sd_hash) d = self._get_claim_metadata_for_sd_hash(sd_hash)
d.addCallback(lambda name_txid: self._get_status_of_claim(name_txid[1], name_txid[0], sd_hash) if name_txid is not None else None) d.addCallback(lambda name_txid: self._get_status_of_claim(name_txid[1], name_txid[0], sd_hash) if name_txid is not None else None)
@ -688,6 +692,9 @@ class LBRYWallet(object):
def _get_balance_for_address(self, address): def _get_balance_for_address(self, address):
return defer.fail(NotImplementedError()) return defer.fail(NotImplementedError())
def _get_history(self):
return defer.fail(NotImplementedError())
def _start(self): def _start(self):
pass pass
@ -823,6 +830,9 @@ class LBRYcrdWallet(LBRYWallet):
def _get_value_for_name(self, name): def _get_value_for_name(self, name):
return threads.deferToThread(self._get_value_for_name_rpc, name) return threads.deferToThread(self._get_value_for_name_rpc, name)
def _get_history(self):
return threads.deferToThread(self._list_transactions_rpc)
def _get_rpc_conn(self): def _get_rpc_conn(self):
return AuthServiceProxy(self.rpc_conn_string) return AuthServiceProxy(self.rpc_conn_string)
@ -1007,6 +1017,11 @@ class LBRYcrdWallet(LBRYWallet):
rpc_conn = self._get_rpc_conn() rpc_conn = self._get_rpc_conn()
return rpc_conn.getbestblockhash() return rpc_conn.getbestblockhash()
@_catch_connection_error
def _list_transactions_rpc(self):
rpc_conn = self._get_rpc_conn()
return rpc_conn.listtransactions()
@_catch_connection_error @_catch_connection_error
def _stop_rpc(self): def _stop_rpc(self):
# check if our lbrycrdd is actually running, or if we connected to one that was already # check if our lbrycrdd is actually running, or if we connected to one that was already
@ -1294,7 +1309,7 @@ class LBRYumWallet(LBRYWallet):
func = getattr(self.cmd_runner, cmd.name) func = getattr(self.cmd_runner, cmd.name)
return threads.deferToThread(func) return threads.deferToThread(func)
def get_history(self): def _get_history(self):
cmd = known_commands['history'] cmd = known_commands['history']
func = getattr(self.cmd_runner, cmd.name) func = getattr(self.cmd_runner, cmd.name)
return threads.deferToThread(func) return threads.deferToThread(func)