utxo list includes purchases of your claims

This commit is contained in:
Lex Berezhny 2019-12-09 18:05:47 -05:00
parent ec65815c57
commit 7d333efd45
2 changed files with 4 additions and 3 deletions

View file

@ -127,7 +127,7 @@ class WalletDatabase(BaseDatabase):
if channel_ids: if channel_ids:
channels = { channels = {
txo.claim_id: txo for txo in txo.claim_id: txo for txo in
(await self.get_claims( (await self.get_channels(
wallet=wallet, wallet=wallet,
claim_id__in=channel_ids claim_id__in=channel_ids
)) ))

View file

@ -16,6 +16,7 @@ from lbry.wallet.network import Network
from lbry.wallet.database import WalletDatabase from lbry.wallet.database import WalletDatabase
from lbry.wallet.transaction import Transaction, Output from lbry.wallet.transaction import Transaction, Output
from lbry.wallet.header import Headers, UnvalidatedHeaders from lbry.wallet.header import Headers, UnvalidatedHeaders
from lbry.wallet.constants import TXO_TYPES
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -112,7 +113,7 @@ class MainNetLedger(BaseLedger):
async def _report_state(self): async def _report_state(self):
try: try:
for account in self.accounts: 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() channel_count = await account.get_channel_count()
claim_count = await account.get_claim_count() claim_count = await account.get_claim_count()
if isinstance(account.receiving, SingleKey): if isinstance(account.receiving, SingleKey):
@ -141,7 +142,7 @@ class MainNetLedger(BaseLedger):
@staticmethod @staticmethod
def constraint_spending_utxos(constraints): def constraint_spending_utxos(constraints):
constraints['txo_type'] = 0 constraints['txo_type__in'] = (0, TXO_TYPES['purchase'])
def get_utxos(self, **constraints): def get_utxos(self, **constraints):
self.constraint_spending_utxos(constraints) self.constraint_spending_utxos(constraints)