forked from LBRYCommunity/lbry-sdk
dropped block_show command from API, users should run a full node if they need access to blocks
This commit is contained in:
parent
72f0e1ca14
commit
6a2efa54ab
5 changed files with 2 additions and 34 deletions
|
@ -310,7 +310,7 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_api_definitions(cls):
|
def get_api_definitions(cls):
|
||||||
prefix = 'jsonrpc_'
|
prefix = 'jsonrpc_'
|
||||||
not_grouped = ['block_show', 'report_bug', 'routing_table_get']
|
not_grouped = ['routing_table_get']
|
||||||
api = {
|
api = {
|
||||||
'groups': {
|
'groups': {
|
||||||
group_name[:-len('_DOC')].lower(): getattr(cls, group_name).strip()
|
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()
|
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_DOC = """
|
||||||
Blob management.
|
Blob management.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -308,13 +308,6 @@ class LbryWalletManager(BaseWalletManager):
|
||||||
for wallet in self.wallets:
|
for wallet in self.wallets:
|
||||||
wallet.save()
|
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):
|
def get_claim_by_claim_id(self, claim_id):
|
||||||
return self.ledger.get_claim_by_claim_id(claim_id)
|
return self.ledger.get_claim_by_claim_id(claim_id)
|
||||||
|
|
||||||
|
|
|
@ -3,9 +3,6 @@ from torba.client.basenetwork import BaseNetwork
|
||||||
|
|
||||||
class Network(BaseNetwork):
|
class Network(BaseNetwork):
|
||||||
|
|
||||||
def get_block(self, block_hash):
|
|
||||||
return self.rpc('blockchain.block.get_block', block_hash)
|
|
||||||
|
|
||||||
def get_server_height(self):
|
def get_server_height(self):
|
||||||
return self.rpc('blockchain.block.get_server_height')
|
return self.rpc('blockchain.block.get_server_height')
|
||||||
|
|
||||||
|
|
|
@ -82,10 +82,6 @@ class Examples(CommandTestCase):
|
||||||
'Get settings',
|
'Get settings',
|
||||||
'settings', 'get'
|
'settings', 'get'
|
||||||
)
|
)
|
||||||
await r(
|
|
||||||
'Show contents of the first block.',
|
|
||||||
'block_show', '--height=1'
|
|
||||||
)
|
|
||||||
|
|
||||||
# accounts
|
# accounts
|
||||||
|
|
||||||
|
|
|
@ -783,8 +783,7 @@ class StreamCommands(CommandTestCase):
|
||||||
self.assertNotEqual(r1c, r2c)
|
self.assertNotEqual(r1c, r2c)
|
||||||
|
|
||||||
await self.generate(50)
|
await self.generate(50)
|
||||||
head = await self.daemon.jsonrpc_block_show()
|
self.assertTrue(self.ledger.headers.height > 250)
|
||||||
self.assertTrue(head['height'] > 250)
|
|
||||||
|
|
||||||
r3 = await self.daemon.jsonrpc_resolve(urls='lbry://ΣίσυφοςfiÆ')
|
r3 = await self.daemon.jsonrpc_resolve(urls='lbry://ΣίσυφοςfiÆ')
|
||||||
r4 = await self.daemon.jsonrpc_resolve(urls='lbry://ΣΊΣΥΦΟσFIæ')
|
r4 = await self.daemon.jsonrpc_resolve(urls='lbry://ΣΊΣΥΦΟσFIæ')
|
||||||
|
|
Loading…
Reference in a new issue