This commit is contained in:
Lex Berezhny 2021-04-14 10:14:41 -04:00
parent 6acf94a810
commit 3cfc292d84
2 changed files with 5 additions and 3 deletions

View file

@ -5,7 +5,6 @@ import logging
import typing import typing
import asyncio import asyncio
import random import random
from functools import partial
from hashlib import sha256 from hashlib import sha256
from string import hexdigits from string import hexdigits
from typing import Type, Dict, Tuple, Optional, Any, List from typing import Type, Dict, Tuple, Optional, Any, List
@ -16,7 +15,7 @@ from lbry.crypto.crypt import aes_encrypt, aes_decrypt
from .bip32 import PrivateKey, PubKey, from_extended_key_string from .bip32 import PrivateKey, PubKey, from_extended_key_string
from .mnemonic import Mnemonic from .mnemonic import Mnemonic
from .constants import COIN, CLAIM_TYPES, TXO_TYPES from .constants import COIN, TXO_TYPES
from .transaction import Transaction, Input, Output from .transaction import Transaction, Input, Output
if typing.TYPE_CHECKING: if typing.TYPE_CHECKING:

View file

@ -1147,7 +1147,10 @@ class Database(SQLiteMixin):
result = (await self.select_txos( result = (await self.select_txos(
f"COALESCE(SUM(amount), 0) AS total," f"COALESCE(SUM(amount), 0) AS total,"
f"COALESCE(SUM(CASE WHEN txo_type != {TXO_TYPES['other']} THEN amount ELSE 0 END), 0) AS reserved," f"COALESCE(SUM(CASE WHEN txo_type != {TXO_TYPES['other']} THEN amount ELSE 0 END), 0) AS reserved,"
f"COALESCE(SUM(CASE WHEN txo_type IN ({','.join(map(str, CLAIM_TYPES))}) THEN amount ELSE 0 END), 0) AS claims," f"COALESCE(SUM("
f" CASE WHEN"
f" txo_type IN ({','.join(map(str, CLAIM_TYPES))})"
f" THEN amount ELSE 0 END), 0) AS claims,"
f"COALESCE(SUM(CASE WHEN txo_type = {TXO_TYPES['support']} THEN amount ELSE 0 END), 0) AS supports," f"COALESCE(SUM(CASE WHEN txo_type = {TXO_TYPES['support']} THEN amount ELSE 0 END), 0) AS supports,"
f"COALESCE(SUM(" f"COALESCE(SUM("
f" CASE WHEN" f" CASE WHEN"