@@ -1623,8 +1623,9 @@ def test_dedup_info_eligible_1st_time() -> None:
16231623 Coin (TEST_COIN_ID , IDENTITY_PUZZLE_HASH , uint64 (1 )),
16241624 Coin (TEST_COIN_ID , IDENTITY_PUZZLE_HASH , uint64 (TEST_COIN_AMOUNT - 1 )),
16251625 }
1626+ expected_cost = mempool_item .bundle_coin_spends [TEST_COIN_ID ].cost
16261627 assert dedup_coin_spends == IdenticalSpendDedup (
1627- {TEST_COIN_ID : DedupCoinSpend (solution = solution , cost = uint64 ( 3600044 ) )}
1628+ {TEST_COIN_ID : DedupCoinSpend (solution = solution , cost = expected_cost )}
16281629 )
16291630
16301631
@@ -1650,8 +1651,9 @@ def test_dedup_info_eligible_2nd_time_and_another_1st_time() -> None:
16501651 [ConditionOpcode .CREATE_COIN , IDENTITY_PUZZLE_HASH , TEST_COIN_AMOUNT - 1 ],
16511652 ]
16521653 initial_solution = SerializedProgram .to (initial_conditions )
1654+ test_coin_cost = uint64 (1337 )
16531655 dedup_coin_spends = IdenticalSpendDedup (
1654- {TEST_COIN_ID : DedupCoinSpend (solution = initial_solution , cost = uint64 ( 1337 ) )}
1656+ {TEST_COIN_ID : DedupCoinSpend (solution = initial_solution , cost = test_coin_cost )}
16551657 )
16561658 sb1 = spend_bundle_from_conditions (initial_conditions , TEST_COIN )
16571659 second_conditions = [[ConditionOpcode .CREATE_COIN , IDENTITY_PUZZLE_HASH , TEST_COIN_AMOUNT2 ]]
@@ -1665,14 +1667,15 @@ def test_dedup_info_eligible_2nd_time_and_another_1st_time() -> None:
16651667 )
16661668 # Only the eligible one that we encountered more than once gets deduplicated
16671669 assert unique_coin_spends == sb2 .coin_spends
1668- assert cost_saving == uint64 ( 1337 )
1670+ assert cost_saving == test_coin_cost
16691671 assert unique_additions == [Coin (TEST_COIN_ID2 , IDENTITY_PUZZLE_HASH , TEST_COIN_AMOUNT2 )]
1670- # The coin we encountered a second time has its cost and additions properly updated
1671- # The coin we encountered for the first time gets cost None and an empty set of additions
1672+ # The coin we encountered a second time is already in the map
1673+ # The coin we encountered for the first time gets added with its solution and cost
1674+ test_coin2_cost = mempool_item .bundle_coin_spends [TEST_COIN_ID2 ].cost
16721675 expected_dedup_coin_spends = IdenticalSpendDedup (
16731676 {
1674- TEST_COIN_ID : DedupCoinSpend (solution = initial_solution , cost = uint64 ( 1337 ) ),
1675- TEST_COIN_ID2 : DedupCoinSpend (solution = second_solution , cost = uint64 ( 1800044 ) ),
1677+ TEST_COIN_ID : DedupCoinSpend (solution = initial_solution , cost = test_coin_cost ),
1678+ TEST_COIN_ID2 : DedupCoinSpend (solution = second_solution , cost = test_coin2_cost ),
16761679 }
16771680 )
16781681 assert dedup_coin_spends == expected_dedup_coin_spends
@@ -1687,11 +1690,12 @@ def test_dedup_info_eligible_3rd_time_another_2nd_time_and_one_non_eligible() ->
16871690 initial_solution = SerializedProgram .to (initial_conditions )
16881691 second_conditions = [[ConditionOpcode .CREATE_COIN , IDENTITY_PUZZLE_HASH , TEST_COIN_AMOUNT2 ]]
16891692 second_solution = SerializedProgram .to (second_conditions )
1690- saved_cost = uint64 (3600044 )
1693+ test_coin_cost = uint64 (42 )
1694+ test_coin2_cost = uint64 (1337 )
16911695 dedup_coin_spends = IdenticalSpendDedup (
16921696 {
1693- TEST_COIN_ID : DedupCoinSpend (solution = initial_solution , cost = saved_cost ),
1694- TEST_COIN_ID2 : DedupCoinSpend (solution = second_solution , cost = uint64 ( 1337 ) ),
1697+ TEST_COIN_ID : DedupCoinSpend (solution = initial_solution , cost = test_coin_cost ),
1698+ TEST_COIN_ID2 : DedupCoinSpend (solution = second_solution , cost = test_coin2_cost ),
16951699 }
16961700 )
16971701 sb1 = spend_bundle_from_conditions (initial_conditions , TEST_COIN )
@@ -1711,13 +1715,13 @@ def test_dedup_info_eligible_3rd_time_another_2nd_time_and_one_non_eligible() ->
17111715 bundle_coin_spends = mempool_item .bundle_coin_spends
17121716 )
17131717 assert unique_coin_spends == sb3 .coin_spends
1714- saved_cost2 = uint64 (1337 )
1715- assert cost_saving == saved_cost + saved_cost2
1718+ assert cost_saving == test_coin_cost + test_coin2_cost
17161719 assert unique_additions == [Coin (TEST_COIN_ID3 , IDENTITY_PUZZLE_HASH , TEST_COIN_AMOUNT3 )]
1720+ # TEST_COIN_ID3 is non-eligible, so it doesn't end up in this map
17171721 expected_dedup_coin_spends = IdenticalSpendDedup (
17181722 {
1719- TEST_COIN_ID : DedupCoinSpend (initial_solution , saved_cost ),
1720- TEST_COIN_ID2 : DedupCoinSpend (second_solution , saved_cost2 ),
1723+ TEST_COIN_ID : DedupCoinSpend (initial_solution , test_coin_cost ),
1724+ TEST_COIN_ID2 : DedupCoinSpend (second_solution , test_coin2_cost ),
17211725 }
17221726 )
17231727 assert dedup_coin_spends == expected_dedup_coin_spends
@@ -1787,20 +1791,21 @@ async def test_bundle_coin_spends() -> None:
17871791 await send_spendbundle (mempool_manager , sb123e )
17881792 mi123e = mempool_manager .get_mempool_item (sb123e .name ())
17891793 assert mi123e is not None
1794+ execution_cost = 44
17901795 for i in range (3 ):
17911796 assert mi123e .bundle_coin_spends [coins [i ].name ()] == BundleCoinSpend (
17921797 coin_spend = sb123 .coin_spends [i ],
17931798 eligible_for_dedup = False ,
17941799 eligible_for_fast_forward = False ,
17951800 additions = [Coin (coins [i ].name (), IDENTITY_PUZZLE_HASH , coins [i ].amount )],
1796- cost = uint64 (3000044 ),
1801+ cost = uint64 (ConditionCost . CREATE_COIN . value + ConditionCost . AGG_SIG . value + execution_cost ),
17971802 )
17981803 assert mi123e .bundle_coin_spends [coins [3 ].name ()] == BundleCoinSpend (
17991804 coin_spend = eligible_sb .coin_spends [0 ],
18001805 eligible_for_dedup = True ,
18011806 eligible_for_fast_forward = False ,
18021807 additions = [Coin (coins [3 ].name (), IDENTITY_PUZZLE_HASH , coins [3 ].amount )],
1803- cost = uint64 (1800044 ),
1808+ cost = uint64 (ConditionCost . CREATE_COIN . value + execution_cost ),
18041809 )
18051810
18061811
0 commit comments