Skip to content

Commit 75dbb0b

Browse files
committed
remove use of pool_reward_puzzle_hash in full_node_simulator
1 parent 8d4cbab commit 75dbb0b

File tree

1 file changed

+26
-4
lines changed

1 file changed

+26
-4
lines changed

chia/simulator/full_node_simulator.py

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,12 +237,17 @@ async def farm_new_transaction_block(
237237

238238
current_blocks = await self.get_all_full_blocks()
239239
target = request.puzzle_hash
240+
pool_target: bytes32 | None = target
241+
if current_blocks[-1].height >= self.full_node.constants.HARD_FORK2_HEIGHT - 1:
242+
# v2 plots (which we start farming at the hard fork activation)
243+
# don't support specifying the pool target
244+
pool_target = None
240245
more = self.bt.get_consecutive_blocks(
241246
1,
242247
time_per_block=time_per_block,
243248
transaction_data=spend_bundle,
244249
farmer_reward_puzzle_hash=target,
245-
pool_reward_puzzle_hash=target,
250+
pool_reward_puzzle_hash=pool_target,
246251
block_list_input=current_blocks,
247252
guarantee_transaction_block=True,
248253
current_time=current_time,
@@ -289,11 +294,16 @@ async def farm_new_block(self, request: FarmNewBlockProtocol, force_wait_for_tim
289294
spend_bundle = mempool_bundle[0]
290295
current_blocks = await self.get_all_full_blocks()
291296
target = request.puzzle_hash
297+
pool_target: bytes32 | None = target
298+
if current_blocks[-1].height >= self.full_node.constants.HARD_FORK2_HEIGHT - 1:
299+
# v2 plots (which we start farming at the hard fork activation)
300+
# don't support specifying the pool target
301+
pool_target = None
292302
more = self.bt.get_consecutive_blocks(
293303
1,
294304
transaction_data=spend_bundle,
295305
farmer_reward_puzzle_hash=target,
296-
pool_reward_puzzle_hash=target,
306+
pool_reward_puzzle_hash=pool_target,
297307
block_list_input=current_blocks,
298308
current_time=current_time,
299309
time_per_block=time_per_block,
@@ -311,10 +321,15 @@ async def reorg_from_index_to_new_index(self, request: ReorgProtocol):
311321
current_blocks = await self.get_all_full_blocks()
312322
block_count = new_index - old_index
313323

324+
pool_target: bytes32 | None = coinbase_ph
325+
if current_blocks[-1].height >= self.full_node.constants.HARD_FORK2_HEIGHT - 1:
326+
# v2 plots (which we start farming at the hard fork activation)
327+
# don't support specifying the pool target
328+
pool_target = None
314329
more_blocks = self.bt.get_consecutive_blocks(
315330
block_count,
316331
farmer_reward_puzzle_hash=coinbase_ph,
317-
pool_reward_puzzle_hash=coinbase_ph,
332+
pool_reward_puzzle_hash=pool_target,
318333
block_list_input=current_blocks[: old_index + 1],
319334
force_overflow=True,
320335
guarantee_transaction_block=True,
@@ -398,12 +413,19 @@ async def farm_blocks_to_wallet(
398413
rewards = 0
399414

400415
block_reward_coins = set()
401-
expected_reward_coin_count = 2 * count
402416

403417
original_peak_height = self.full_node.blockchain.get_peak_height()
404418
expected_peak_height = 0 if original_peak_height is None else original_peak_height
405419
extra_blocks = [[False, False]] if original_peak_height is None else [] # Farm genesis block first
406420

421+
if expected_peak_height >= self.full_node.constants.HARD_FORK2_HEIGHT - 1:
422+
# v2 plots (which we start farming at the hard fork activation)
423+
# don't support specifying the pool target, so we only get the
424+
# farmer reward, not the pool reward
425+
expected_reward_coin_count = count
426+
else:
427+
expected_reward_coin_count = 2 * count
428+
407429
for to_wallet, tx_block in [*extra_blocks, *([[True, False]] * (count - 1)), [True, True], [False, True]]:
408430
# This complicated application of the last two blocks being transaction
409431
# blocks is due to the transaction blocks only including rewards from

0 commit comments

Comments
 (0)