mirror of
https://github.com/LBRYFoundation/lbry-sdk.git
synced 2025-08-31 17:31:29 +00:00
fix purchase_create
This commit is contained in:
parent
61d02fc5d7
commit
b11184de68
3 changed files with 5 additions and 5 deletions
|
@ -2155,11 +2155,11 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||||
accounts = wallet.get_accounts_or_all(funding_account_ids)
|
accounts = wallet.get_accounts_or_all(funding_account_ids)
|
||||||
txo = None
|
txo = None
|
||||||
if claim_id:
|
if claim_id:
|
||||||
txo = await self.ledger.get_claim_by_claim_id(accounts, claim_id)
|
txo = await self.ledger.get_claim_by_claim_id(accounts, claim_id, include_purchase_receipt=True)
|
||||||
if not isinstance(txo, Output) or not txo.is_claim:
|
if not isinstance(txo, Output) or not txo.is_claim:
|
||||||
raise Exception(f"Could not find claim with claim_id '{claim_id}'. ")
|
raise Exception(f"Could not find claim with claim_id '{claim_id}'. ")
|
||||||
elif url:
|
elif url:
|
||||||
txo = (await self.ledger.resolve(accounts, [url]))[url]
|
txo = (await self.ledger.resolve(accounts, [url], include_purchase_receipt=True))[url]
|
||||||
if not isinstance(txo, Output) or not txo.is_claim:
|
if not isinstance(txo, Output) or not txo.is_claim:
|
||||||
raise Exception(f"Could not find claim with url '{url}'. ")
|
raise Exception(f"Could not find claim with url '{url}'. ")
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -752,8 +752,8 @@ class Ledger(metaclass=LedgerRegistry):
|
||||||
include_is_my_output=include_is_my_output
|
include_is_my_output=include_is_my_output
|
||||||
)
|
)
|
||||||
|
|
||||||
async def get_claim_by_claim_id(self, accounts, claim_id) -> Output:
|
async def get_claim_by_claim_id(self, accounts, claim_id, **kwargs) -> Output:
|
||||||
for claim in (await self.claim_search(accounts, claim_id=claim_id))[0]:
|
for claim in (await self.claim_search(accounts, claim_id=claim_id, **kwargs))[0]:
|
||||||
return claim
|
return claim
|
||||||
|
|
||||||
async def _report_state(self):
|
async def _report_state(self):
|
||||||
|
|
|
@ -147,7 +147,7 @@ class PurchaseCommandTests(CommandTestCase):
|
||||||
self.assertEqual(result[1]['claim_id'], result[1]['purchase_receipt']['claim_id'])
|
self.assertEqual(result[1]['claim_id'], result[1]['purchase_receipt']['claim_id'])
|
||||||
|
|
||||||
url = result[0]['canonical_url']
|
url = result[0]['canonical_url']
|
||||||
resolve = await self.resolve(url)
|
resolve = await self.resolve(url, include_purchase_receipt=True)
|
||||||
self.assertEqual(result[0]['claim_id'], resolve['purchase_receipt']['claim_id'])
|
self.assertEqual(result[0]['claim_id'], resolve['purchase_receipt']['claim_id'])
|
||||||
|
|
||||||
self.assertItemCount(await self.daemon.jsonrpc_file_list(), 0)
|
self.assertItemCount(await self.daemon.jsonrpc_file_list(), 0)
|
||||||
|
|
Loading…
Add table
Reference in a new issue