Skip to content

Commit

Permalink
use default_factory= for SpendableCAT mutable defaults (#14214)
Browse files Browse the repository at this point in the history
extracted from #11407
  • Loading branch information
altendky committed Dec 23, 2022
1 parent 7cba58e commit 3056db6
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions chia/wallet/cat_wallet/cat_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,24 @@
ANYONE_CAN_SPEND_PUZZLE = Program.to(1) # simply return the conditions


def empty_program() -> Program:
# ignoring hint error here for:
# https://github.com/Chia-Network/clvm/pull/102
# https://github.com/Chia-Network/clvm/pull/106
return Program.to([]) # type: ignore[no-any-return]


# information needed to spend a cc
@dataclasses.dataclass
class SpendableCAT:
coin: Coin
limitations_program_hash: bytes32
inner_puzzle: Program
inner_solution: Program
limitations_solution: Program = Program.to([])
limitations_solution: Program = dataclasses.field(default_factory=empty_program)
lineage_proof: LineageProof = LineageProof()
extra_delta: int = 0
limitations_program_reveal: Program = Program.to([])
limitations_program_reveal: Program = dataclasses.field(default_factory=empty_program)


def match_cat_puzzle(puzzle: UncurriedPuzzle) -> Optional[Iterator[Program]]:
Expand Down

0 comments on commit 3056db6

Please sign in to comment.