[bug] remove get_block_info as it doesnt make sense, unify to get_block (#1425)
This commit is contained in:
parent
1c6ce49b7b
commit
93d134f0ce
2 changed files with 6 additions and 14 deletions
|
@ -10,7 +10,6 @@ from operator import itemgetter
|
|||
from binascii import hexlify, unhexlify
|
||||
from copy import deepcopy
|
||||
from decimal import Decimal, InvalidOperation
|
||||
from twisted.web import server
|
||||
from twisted.internet import defer, reactor
|
||||
from twisted.internet.task import LoopingCall
|
||||
from twisted.python.failure import Failure
|
||||
|
@ -2511,14 +2510,7 @@ class Daemon(AuthJSONRPCServer):
|
|||
Returns:
|
||||
(dict) Requested block
|
||||
"""
|
||||
|
||||
if blockhash is not None:
|
||||
return self.wallet.get_block(blockhash)
|
||||
elif height is not None:
|
||||
return self.wallet.get_block_info(height)
|
||||
else:
|
||||
# TODO: return a useful error message
|
||||
return server.failure
|
||||
return self.wallet.get_block(blockhash, height)
|
||||
|
||||
@requires(WALLET_COMPONENT, DHT_COMPONENT, BLOB_COMPONENT, RATE_LIMITER_COMPONENT, PAYMENT_RATE_COMPONENT,
|
||||
conditions=[WALLET_IS_UNLOCKED])
|
||||
|
|
|
@ -291,13 +291,13 @@ class LbryWalletManager(BaseWalletManager):
|
|||
for wallet in self.wallets:
|
||||
wallet.save()
|
||||
|
||||
def get_block(self, block_hash):
|
||||
def get_block(self, block_hash=None, height=None):
|
||||
if height is None:
|
||||
height = self.ledger.headers.height
|
||||
if block_hash is None:
|
||||
block_hash = self.ledger.headers.hash(height).decode()
|
||||
return self.ledger.network.get_block(block_hash)
|
||||
|
||||
def get_block_info(self, height):
|
||||
block_hash = self.ledger.headers.hash(height).decode()
|
||||
return self.get_block(block_hash)
|
||||
|
||||
def get_claim_by_claim_id(self, claim_id):
|
||||
return self.ledger.get_claim_by_claim_id(claim_id)
|
||||
|
||||
|
|
Loading…
Reference in a new issue