dropped block_show command from API, users should run a full node if they need access to blocks

This commit is contained in:
Lex Berezhny 2019-04-27 17:15:37 -04:00
parent 72f0e1ca14
commit 6a2efa54ab
5 changed files with 2 additions and 34 deletions

View file

@ -310,7 +310,7 @@ class Daemon(metaclass=JSONRPCServerType):
@classmethod
def get_api_definitions(cls):
prefix = 'jsonrpc_'
not_grouped = ['block_show', 'report_bug', 'routing_table_get']
not_grouped = ['routing_table_get']
api = {
'groups': {
group_name[:-len('_DOC')].lower(): getattr(cls, group_name).strip()
@ -2902,23 +2902,6 @@ class Daemon(metaclass=JSONRPCServerType):
"""
return self.get_account_or_default(account_id).release_all_outputs()
@requires(WALLET_COMPONENT)
def jsonrpc_block_show(self, blockhash=None, height=None):
"""
Get contents of a block
Usage:
block_show (<blockhash> | --blockhash=<blockhash>) | (<height> | --height=<height>)
Options:
--blockhash=<blockhash> : (str) hash of the block to look up
--height=<height> : (int) height of the block to look up
Returns:
(dict) Requested block
"""
return self.wallet_manager.get_block(blockhash, height)
BLOB_DOC = """
Blob management.
"""

View file

@ -308,13 +308,6 @@ class LbryWalletManager(BaseWalletManager):
for wallet in self.wallets:
wallet.save()
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_claim_by_claim_id(self, claim_id):
return self.ledger.get_claim_by_claim_id(claim_id)

View file

@ -3,9 +3,6 @@ from torba.client.basenetwork import BaseNetwork
class Network(BaseNetwork):
def get_block(self, block_hash):
return self.rpc('blockchain.block.get_block', block_hash)
def get_server_height(self):
return self.rpc('blockchain.block.get_server_height')

View file

@ -82,10 +82,6 @@ class Examples(CommandTestCase):
'Get settings',
'settings', 'get'
)
await r(
'Show contents of the first block.',
'block_show', '--height=1'
)
# accounts

View file

@ -783,8 +783,7 @@ class StreamCommands(CommandTestCase):
self.assertNotEqual(r1c, r2c)
await self.generate(50)
head = await self.daemon.jsonrpc_block_show()
self.assertTrue(head['height'] > 250)
self.assertTrue(self.ledger.headers.height > 250)
r3 = await self.daemon.jsonrpc_resolve(urls='lbry://ΣίσυφοςfiÆ')
r4 = await self.daemon.jsonrpc_resolve(urls='lbry://ΣΊΣΥΦΟσFIæ')