Skip to content

Commit

Permalink
Compute and reuse launcher_id (#17360)
Browse files Browse the repository at this point in the history
Compute and reuse launcher_id.
  • Loading branch information
AmineKhaldi committed Jan 20, 2024
1 parent 4ec439f commit 2c502de
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tests/wallet/test_singleton_lifecycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,13 @@ def launcher_conditions_and_spend_bundle(
) -> Tuple[bytes32, List[Program], SpendBundle]:
launcher_puzzle_hash = launcher_puzzle.get_tree_hash()
launcher_coin = Coin(parent_coin_id, launcher_puzzle_hash, launcher_amount)
launcher_id = launcher_coin.name()
singleton_full_puzzle = SINGLETON_MOD.curry(
SINGLETON_MOD_HASH, launcher_coin.name(), launcher_puzzle_hash, initial_singleton_inner_puzzle
SINGLETON_MOD_HASH, launcher_id, launcher_puzzle_hash, initial_singleton_inner_puzzle
)
singleton_full_puzzle_hash = singleton_full_puzzle.get_tree_hash()
message_program = Program.to([singleton_full_puzzle_hash, launcher_amount, metadata])
expected_announcement = Announcement(launcher_coin.name(), message_program.get_tree_hash())
expected_announcement = Announcement(launcher_id, message_program.get_tree_hash())
expected_conditions = []
expected_conditions.append(
Program.to(
Expand All @@ -70,7 +71,7 @@ def launcher_conditions_and_spend_bundle(
launcher_solution = Program.to([singleton_full_puzzle_hash, launcher_amount, metadata])
coin_spend = make_spend(launcher_coin, launcher_puzzle, launcher_solution)
spend_bundle = SpendBundle([coin_spend], G2Element())
return launcher_coin.name(), expected_conditions, spend_bundle
return launcher_id, expected_conditions, spend_bundle


def singleton_puzzle(launcher_id: Program, launcher_puzzle_hash: bytes32, inner_puzzle: Program) -> Program:
Expand Down

0 comments on commit 2c502de

Please sign in to comment.