mirror of
https://github.com/Chia-Network/chia-blockchain.git
synced 2024-11-11 01:28:17 +03:00
b084813b12
* Avoid importing `test_constants` as it takes a long time. * Factor out `parse_*` functions. * First crack at refactoring `Streamable.parse`. * Don't add `_parse_functions` attribute to `Streamable`. This no longer requires an extra `_parse_functions` attribute on a `Streamable`, as it may be confusing serializers or other functions that use `__annotations__`. * Fix lint problems with `black`. * Fix `parse_tuple`. * Defer some parsing failures to parse time rather than class-creation time. * Tidy up & remove some obsolete stuff. * Decorate `RequestBlocks` as `streamable`. * Fix wrong uses of Streamable class Revert an earlier commit and error out on class creation in case a Streamable subclass is instantiated incorrectly, e.g. containing a non-serializable member. Fix cases where Streamable parent class was forgotten. * Fix wrong types when creating DerivationRecord and WalletCoinRecord * additional unit tests for streamable parsers * add type annotations (#3222) Co-authored-by: Rostislav <rostislav@users.noreply.github.com> Co-authored-by: arvidn <arvid@libtorrent.org>
26 lines
639 B
Python
26 lines
639 B
Python
from dataclasses import dataclass
|
|
|
|
from chia.types.blockchain_format.coin import Coin
|
|
from chia.types.blockchain_format.sized_bytes import bytes32
|
|
from chia.util.ints import uint32
|
|
from chia.wallet.util.wallet_types import WalletType
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class WalletCoinRecord:
|
|
"""
|
|
These are values that correspond to a CoinName that are used
|
|
in keeping track of the unspent database.
|
|
"""
|
|
|
|
coin: Coin
|
|
confirmed_block_height: uint32
|
|
spent_block_height: uint32
|
|
spent: bool
|
|
coinbase: bool
|
|
wallet_type: WalletType
|
|
wallet_id: int
|
|
|
|
def name(self) -> bytes32:
|
|
return self.coin.name()
|