@@ -373,7 +373,7 @@ def test_callback(event: PlotRefreshEvents, update_result: PlotRefreshResult) ->
373373
374374 def setup_new_gen (
375375 self ,
376- tx_block_heights : list [uint32 ],
376+ generator_block_heights : list [uint32 ],
377377 curr : BlockRecordProtocol ,
378378 wallet : Optional [WalletTool ],
379379 rng : Optional [random .Random ],
@@ -391,11 +391,11 @@ def setup_new_gen(
391391 # available_coins) until it's confirmed the block
392392 # generator made it into the block.
393393 dummy_refs : list [uint32 ]
394- if dummy_block_references and len (tx_block_heights ) > 4 :
394+ if dummy_block_references and len (generator_block_heights ) > 4 :
395395 dummy_refs = [
396- tx_block_heights [1 ],
397- tx_block_heights [len (tx_block_heights ) // 2 ],
398- tx_block_heights [- 2 ],
396+ generator_block_heights [1 ],
397+ generator_block_heights [len (generator_block_heights ) // 2 ],
398+ generator_block_heights [- 2 ],
399399 ]
400400 else :
401401 dummy_refs = []
@@ -754,13 +754,17 @@ def get_consecutive_blocks(
754754 else :
755755 block_list = []
756756
757- tx_block_heights : list [uint32 ] = []
757+ # these are heights of blocks that have transactions generators. Note
758+ # that there may be transactions blocks without generators. These are
759+ # used to generate dummy block references. Block references require
760+ # generators, not just transaction blocks.
761+ generator_block_heights : list [uint32 ] = []
758762 if dummy_block_references :
759763 # block references can only point to transaction blocks, so we need
760764 # to record which ones are
761765 for b in block_list :
762766 if b .transactions_generator is not None :
763- tx_block_heights .append (b .height )
767+ generator_block_heights .append (b .height )
764768
765769 constants = self .constants
766770
@@ -909,7 +913,7 @@ def get_consecutive_blocks(
909913 difficulty ,
910914 sub_slot_iters ,
911915 curr .height ,
912- tx_block_heights [ - 1 ] if len ( tx_block_heights ) > 0 else uint32 ( 0 ) ,
916+ prev_tx_height ,
913917 force_plot_id = force_plot_id ,
914918 )
915919
@@ -937,7 +941,7 @@ def get_consecutive_blocks(
937941 pool_target = PoolTarget (self .pool_ph , uint32 (0 ))
938942
939943 new_gen = self .setup_new_gen (
940- tx_block_heights ,
944+ generator_block_heights ,
941945 curr ,
942946 wallet ,
943947 rng ,
@@ -1009,8 +1013,10 @@ def get_consecutive_blocks(
10091013 available_coins .remove (rem )
10101014 available_coins .extend (new_gen .additions )
10111015
1016+ if full_block .transactions_generator is not None :
1017+ generator_block_heights .append (full_block .height )
1018+
10121019 if full_block .is_transaction_block ():
1013- tx_block_heights .append (full_block .height )
10141020 prev_tx_height = full_block .height
10151021
10161022 blocks_added_this_sub_slot += 1
@@ -1212,7 +1218,7 @@ def get_consecutive_blocks(
12121218 difficulty ,
12131219 sub_slot_iters ,
12141220 curr .height ,
1215- tx_block_heights [ - 1 ] if len ( tx_block_heights ) > 0 else uint32 ( 0 ) ,
1221+ prev_tx_height ,
12161222 force_plot_id = force_plot_id ,
12171223 )
12181224 for required_iters , proof_of_space in sorted (qualified_proofs , key = lambda t : t [0 ]):
@@ -1231,7 +1237,7 @@ def get_consecutive_blocks(
12311237 pool_target = PoolTarget (self .pool_ph , uint32 (0 ))
12321238
12331239 new_gen = self .setup_new_gen (
1234- tx_block_heights ,
1240+ generator_block_heights ,
12351241 curr ,
12361242 wallet ,
12371243 rng ,
@@ -1303,8 +1309,10 @@ def get_consecutive_blocks(
13031309 available_coins .remove (rem )
13041310 available_coins .extend (new_gen .additions )
13051311
1312+ if full_block .transactions_generator is not None :
1313+ generator_block_heights .append (full_block .height )
1314+
13061315 if full_block .is_transaction_block ():
1307- tx_block_heights .append (full_block .height )
13081316 prev_tx_height = full_block .height
13091317
13101318 blocks_added_this_sub_slot += 1
@@ -1527,7 +1535,7 @@ def get_pospaces_for_challenge(
15271535 difficulty : uint64 ,
15281536 sub_slot_iters : uint64 ,
15291537 height : uint32 ,
1530- prev_transaction_b_height : uint32 ,
1538+ prev_tx_height : uint32 ,
15311539 force_plot_id : Optional [bytes32 ] = None ,
15321540 ) -> list [tuple [uint64 , ProofOfSpace ]]:
15331541 found_proofs : list [tuple [uint64 , ProofOfSpace ]] = []
@@ -1544,7 +1552,7 @@ def get_pospaces_for_challenge(
15441552
15451553 if plot_info .prover .get_version () == PlotVersion .V2 :
15461554 # v2 plots aren't valid until after the hard fork
1547- if prev_transaction_b_height < constants .HARD_FORK2_HEIGHT :
1555+ if prev_tx_height < constants .HARD_FORK2_HEIGHT :
15481556 continue
15491557
15501558 if plot_info .prover .get_strength () < constants .PLOT_STRENGTH_INITIAL :
@@ -1553,7 +1561,7 @@ def get_pospaces_for_challenge(
15531561 f"cannot be used for farming: { plot_info .prover .get_filename ()} "
15541562 )
15551563 continue
1556- elif prev_transaction_b_height >= constants .HARD_FORK2_HEIGHT + constants .PLOT_V1_PHASE_OUT :
1564+ elif prev_tx_height >= constants .HARD_FORK2_HEIGHT + constants .PLOT_V1_PHASE_OUT :
15571565 continue
15581566
15591567 new_challenge : bytes32 = calculate_pos_challenge (plot_id , challenge_hash , signage_point )
@@ -1570,7 +1578,7 @@ def get_pospaces_for_challenge(
15701578 difficulty ,
15711579 signage_point ,
15721580 sub_slot_iters ,
1573- prev_transaction_b_height ,
1581+ prev_tx_height ,
15741582 )
15751583 if required_iters >= calculate_sp_interval_iters (constants , sub_slot_iters ):
15761584 continue
0 commit comments