@@ -28,25 +28,6 @@ def calculate_sp_iters(constants: ConsensusConstants, sub_slot_iters: uint64, si
2828 return uint64 (calculate_sp_interval_iters (constants , sub_slot_iters ) * signage_point_index )
2929
3030
31- def calculate_phase_out (
32- constants : ConsensusConstants ,
33- sub_slot_iters : uint64 ,
34- prev_transaction_block_height : uint32 ,
35- ) -> uint64 :
36- if prev_transaction_block_height <= constants .HARD_FORK2_HEIGHT :
37- return uint64 (0 )
38- elif uint32 (prev_transaction_block_height - constants .HARD_FORK2_HEIGHT ) >= constants .PLOT_V1_PHASE_OUT :
39- return uint64 (calculate_sp_interval_iters (constants , sub_slot_iters ))
40-
41- return uint64 (
42- (
43- uint32 (prev_transaction_block_height - constants .HARD_FORK2_HEIGHT )
44- * calculate_sp_interval_iters (constants , sub_slot_iters )
45- )
46- // constants .PLOT_V1_PHASE_OUT
47- )
48-
49-
5031def calculate_ip_iters (
5132 constants : ConsensusConstants ,
5233 sub_slot_iters : uint64 ,
@@ -75,11 +56,15 @@ def validate_pospace_and_get_required_iters(
7556 cc_sp_hash : bytes32 ,
7657 height : uint32 ,
7758 difficulty : uint64 ,
78- sub_slot_iters : uint64 ,
7959 prev_transaction_block_height : uint32 , # this is the height of the last tx block before the current block SP
8060) -> Optional [uint64 ]:
8161 q_str : Optional [bytes32 ] = verify_and_get_quality_string (
82- proof_of_space , constants , challenge , cc_sp_hash , height = height
62+ proof_of_space ,
63+ constants ,
64+ challenge ,
65+ cc_sp_hash ,
66+ height = height ,
67+ prev_transaction_block_height = prev_transaction_block_height ,
8368 )
8469 if q_str is None :
8570 return None
@@ -90,8 +75,6 @@ def validate_pospace_and_get_required_iters(
9075 proof_of_space .size (),
9176 difficulty ,
9277 cc_sp_hash ,
93- sub_slot_iters ,
94- prev_transaction_block_height ,
9578 )
9679
9780
@@ -101,27 +84,17 @@ def calculate_iterations_quality(
10184 size : PlotSize ,
10285 difficulty : uint64 ,
10386 cc_sp_output_hash : bytes32 ,
104- ssi : uint64 ,
105- prev_transaction_block_height : uint32 , # this is the height of the last tx block before the current block SP
10687) -> uint64 :
10788 """
10889 Calculates the number of iterations from the quality. This is derives as the difficulty times the constant factor
10990 times a random number between 0 and 1 (based on quality string), divided by plot size.
11091 """
111- if size .size_v1 is not None :
112- assert size .size_v2 is None
113- phase_out = calculate_phase_out (constants , ssi , prev_transaction_block_height )
114- else :
115- phase_out = uint64 (0 )
11692
11793 sp_quality_string : bytes32 = std_hash (quality_string + cc_sp_output_hash )
11894 iters = uint64 (
119- (
120- int (difficulty )
121- * int (constants .DIFFICULTY_CONSTANT_FACTOR )
122- * int .from_bytes (sp_quality_string , "big" , signed = False )
123- // (int (pow (2 , 256 )) * int (_expected_plot_size (size )))
124- )
125- + phase_out
95+ int (difficulty )
96+ * int (constants .DIFFICULTY_CONSTANT_FACTOR )
97+ * int .from_bytes (sp_quality_string , "big" , signed = False )
98+ // (int (pow (2 , 256 )) * int (_expected_plot_size (size )))
12699 )
127100 return max (iters , uint64 (1 ))
0 commit comments