From 7d333efd450b86ae0bb06cfe87871ba005432e98 Mon Sep 17 00:00:00 2001 From: Lex Berezhny Date: Mon, 9 Dec 2019 18:05:47 -0500 Subject: [PATCH] `utxo list` includes purchases of your claims --- lbry/lbry/wallet/database.py | 2 +- lbry/lbry/wallet/ledger.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lbry/lbry/wallet/database.py b/lbry/lbry/wallet/database.py index 5121e2af9..456a9293b 100644 --- a/lbry/lbry/wallet/database.py +++ b/lbry/lbry/wallet/database.py @@ -127,7 +127,7 @@ class WalletDatabase(BaseDatabase): if channel_ids: channels = { txo.claim_id: txo for txo in - (await self.get_claims( + (await self.get_channels( wallet=wallet, claim_id__in=channel_ids )) diff --git a/lbry/lbry/wallet/ledger.py b/lbry/lbry/wallet/ledger.py index 8101bbe3e..15938cb52 100644 --- a/lbry/lbry/wallet/ledger.py +++ b/lbry/lbry/wallet/ledger.py @@ -16,6 +16,7 @@ from lbry.wallet.network import Network from lbry.wallet.database import WalletDatabase from lbry.wallet.transaction import Transaction, Output from lbry.wallet.header import Headers, UnvalidatedHeaders +from lbry.wallet.constants import TXO_TYPES log = logging.getLogger(__name__) @@ -112,7 +113,7 @@ class MainNetLedger(BaseLedger): async def _report_state(self): try: for account in self.accounts: - balance = dewies_to_lbc(await account.get_balance()) + balance = dewies_to_lbc(await account.get_balance(include_claims=True)) channel_count = await account.get_channel_count() claim_count = await account.get_claim_count() if isinstance(account.receiving, SingleKey): @@ -141,7 +142,7 @@ class MainNetLedger(BaseLedger): @staticmethod def constraint_spending_utxos(constraints): - constraints['txo_type'] = 0 + constraints['txo_type__in'] = (0, TXO_TYPES['purchase']) def get_utxos(self, **constraints): self.constraint_spending_utxos(constraints)