1515from chia ._tests .blockchain .blockchain_test_utils import _validate_and_add_block
1616from chia ._tests .conftest import ConsensusMode
1717from chia ._tests .core .full_node .ram_db import create_ram_blockchain
18+ from chia ._tests .core .full_node .test_full_node import find_reward_coin
1819from chia .consensus .condition_tools import agg_sig_additional_data
1920from chia .simulator .block_tools import BlockTools
2021from chia .simulator .keyring import TempKeyring
@@ -46,7 +47,6 @@ async def initial_blocks(bt: BlockTools, block_count: int = 4) -> list[FullBlock
4647 block_count ,
4748 guarantee_transaction_block = True ,
4849 farmer_reward_puzzle_hash = EASY_PUZZLE_HASH ,
49- pool_reward_puzzle_hash = EASY_PUZZLE_HASH ,
5050 genesis_timestamp = uint64 (10000 ),
5151 time_per_block = 10 ,
5252 )
@@ -100,7 +100,7 @@ async def check_conditions(
100100 aggsig : G2Element = G2Element (),
101101) -> tuple [list [CoinRecord ], list [CoinRecord ], FullBlock ]:
102102 blocks = await initial_blocks (bt )
103- coin = blocks [spend_reward_index ]. get_included_reward_coins ()[ 0 ]
103+ coin = find_reward_coin ( blocks [spend_reward_index ], EASY_PUZZLE_HASH )
104104
105105 coin_spend = make_spend (coin , EASY_PUZZLE , condition_solution )
106106 spend_bundle = SpendBundle ([coin_spend ], aggsig )
@@ -142,9 +142,9 @@ async def test_unknown_conditions_with_cost(
142142 # once the hard fork activates, blocks no longer pay the cost of the ROM
143143 # generator (which includes hashing all puzzles).
144144 if consensus_mode >= ConsensusMode .HARD_FORK_2_0 :
145- block_base_cost = 756064
145+ block_base_cost = 756064 - 12000
146146 else :
147- block_base_cost = 761056
147+ block_base_cost = 761056 - 12000
148148 assert new_block .transactions_info is not None
149149 assert new_block .transactions_info .cost - block_base_cost == expected_cost
150150
@@ -163,11 +163,11 @@ async def test_softfork_condition(
163163 _additions , _removals , new_block = await check_conditions (bt , conditions )
164164
165165 if consensus_mode < ConsensusMode .HARD_FORK_2_0 :
166- block_base_cost = 737056
166+ block_base_cost = 737056 - 12000
167167 else :
168168 # once the hard fork activates, blocks no longer pay the cost of the ROM
169169 # generator (which includes hashing all puzzles).
170- block_base_cost = 732064
170+ block_base_cost = 732064 - 12000
171171
172172 # the block_base_cost includes the cost of the bytes for the condition
173173 # with 2 bytes argument. This test works as long as the conditions it's
@@ -266,7 +266,7 @@ async def test_condition(self, opcode: ConditionOpcode, value: int, expected: Er
266266 @pytest .mark .anyio
267267 async def test_invalid_my_id (self , bt : BlockTools ) -> None :
268268 blocks = await initial_blocks (bt )
269- coin = blocks [- 2 ]. get_included_reward_coins ()[ 0 ]
269+ coin = find_reward_coin ( blocks [- 2 ], EASY_PUZZLE_HASH )
270270 wrong_name = bytearray (coin .name ())
271271 wrong_name [- 1 ] ^= 1
272272 conditions = Program .to (assemble (f"(({ ConditionOpcode .ASSERT_MY_COIN_ID [0 ]} 0x{ wrong_name .hex ()} ))" ))
@@ -275,14 +275,14 @@ async def test_invalid_my_id(self, bt: BlockTools) -> None:
275275 @pytest .mark .anyio
276276 async def test_valid_my_id (self , bt : BlockTools ) -> None :
277277 blocks = await initial_blocks (bt )
278- coin = blocks [- 2 ]. get_included_reward_coins ()[ 0 ]
278+ coin = find_reward_coin ( blocks [- 2 ], EASY_PUZZLE_HASH )
279279 conditions = Program .to (assemble (f"(({ ConditionOpcode .ASSERT_MY_COIN_ID [0 ]} 0x{ coin .name ().hex ()} ))" ))
280280 await check_conditions (bt , conditions )
281281
282282 @pytest .mark .anyio
283283 async def test_invalid_coin_announcement (self , bt : BlockTools ) -> None :
284284 blocks = await initial_blocks (bt )
285- coin = blocks [- 2 ]. get_included_reward_coins ()[ 0 ]
285+ coin = find_reward_coin ( blocks [- 2 ], EASY_PUZZLE_HASH )
286286 announce = AssertCoinAnnouncement (asserted_id = coin .name (), asserted_msg = b"test_bad" )
287287 conditions = Program .to (
288288 assemble (
@@ -295,7 +295,7 @@ async def test_invalid_coin_announcement(self, bt: BlockTools) -> None:
295295 @pytest .mark .anyio
296296 async def test_valid_coin_announcement (self , bt : BlockTools ) -> None :
297297 blocks = await initial_blocks (bt )
298- coin = blocks [- 2 ]. get_included_reward_coins ()[ 0 ]
298+ coin = find_reward_coin ( blocks [- 2 ], EASY_PUZZLE_HASH )
299299 announce = AssertCoinAnnouncement (asserted_id = coin .name (), asserted_msg = b"test" )
300300 conditions = Program .to (
301301 assemble (
@@ -373,7 +373,7 @@ async def test_announce_conditions_limit(
373373 """
374374
375375 blocks = await initial_blocks (bt )
376- coin = blocks [- 2 ]. get_included_reward_coins ()[ 0 ]
376+ coin = find_reward_coin ( blocks [- 2 ], EASY_PUZZLE_HASH )
377377 coin_announcement = AssertCoinAnnouncement (asserted_id = coin .name (), asserted_msg = b"test" )
378378 puzzle_announcement = AssertPuzzleAnnouncement (asserted_ph = EASY_PUZZLE_HASH , asserted_msg = b"test" )
379379
@@ -403,7 +403,7 @@ async def test_announce_conditions_limit(
403403 @pytest .mark .anyio
404404 async def test_coin_messages (self , bt : BlockTools , consensus_mode : ConsensusMode ) -> None :
405405 blocks = await initial_blocks (bt )
406- coin = blocks [- 2 ]. get_included_reward_coins ()[ 0 ]
406+ coin = find_reward_coin ( blocks [- 2 ], EASY_PUZZLE_HASH )
407407 conditions = Program .to (
408408 assemble (
409409 f"(({ ConditionOpcode .SEND_MESSAGE [0 ]} 0x3f 'test' 0x{ coin .name ().hex ()} )"
@@ -415,7 +415,7 @@ async def test_coin_messages(self, bt: BlockTools, consensus_mode: ConsensusMode
415415 @pytest .mark .anyio
416416 async def test_parent_messages (self , bt : BlockTools , consensus_mode : ConsensusMode ) -> None :
417417 blocks = await initial_blocks (bt )
418- coin = blocks [- 2 ]. get_included_reward_coins ()[ 0 ]
418+ coin = find_reward_coin ( blocks [- 2 ], EASY_PUZZLE_HASH )
419419 conditions = Program .to (
420420 assemble (
421421 f"(({ ConditionOpcode .SEND_MESSAGE [0 ]} 0x24 'test' 0x{ coin .parent_coin_info } )"
@@ -436,7 +436,7 @@ async def test_parent_messages(self, bt: BlockTools, consensus_mode: ConsensusMo
436436 ('(66 0x27 "foo" {coin}) (67 0x3f "foo" {coin})' , Err .MESSAGE_NOT_SENT_OR_RECEIVED ),
437437 ('(66 0 "foo") (67 0 "foo")' , None ),
438438 ('(66 0 "foobar") (67 0 "foo")' , Err .MESSAGE_NOT_SENT_OR_RECEIVED ),
439- ('(66 0x09 "foo" 1750000000000 ) (67 0x09 "foo" 1750000000000 )' , None ),
439+ ('(66 0x09 "foo" 250000000000 ) (67 0x09 "foo" 250000000000 )' , None ),
440440 ('(66 -1 "foo")' , Err .INVALID_MESSAGE_MODE ),
441441 ('(67 -1 "foo")' , Err .INVALID_MESSAGE_MODE ),
442442 ('(66 0x40 "foo")' , Err .INVALID_MESSAGE_MODE ),
@@ -447,7 +447,7 @@ async def test_message_conditions(
447447 self , bt : BlockTools , consensus_mode : ConsensusMode , conds : str , expected : Err | None
448448 ) -> None :
449449 blocks = await initial_blocks (bt )
450- coin = blocks [- 2 ]. get_included_reward_coins ()[ 0 ]
450+ coin = find_reward_coin ( blocks [- 2 ], EASY_PUZZLE_HASH )
451451 conditions = Program .to (assemble ("(" + conds .format (coin = "0x" + coin .name ().hex ()) + ")" ))
452452
453453 await check_conditions (bt , conditions , expected_err = expected )
@@ -520,7 +520,7 @@ async def test_agg_sig_illegal_suffix(
520520
521521 sk = AugSchemeMPL .key_gen (b"8" * 32 )
522522 pubkey = sk .get_g1 ()
523- coin = blocks [- 2 ]. get_included_reward_coins ()[ 0 ]
523+ coin = find_reward_coin ( blocks [- 2 ], EASY_PUZZLE_HASH )
524524 for msg in [
525525 c .AGG_SIG_ME_ADDITIONAL_DATA ,
526526 c .AGG_SIG_PARENT_ADDITIONAL_DATA ,
0 commit comments