@@ -49,6 +49,8 @@ def make_pos(
4949 k = version_and_size .size_v1
5050 else :
5151 assert version_and_size .size_v2 is not None
52+ # v2 plots only support pool contract puzzle hash, not pool pk
53+ assert pool_contract_puzzle_hash is not None
5254 k = version_and_size .size_v2
5355 assert k is not None
5456 k |= 0x80
@@ -64,6 +66,11 @@ def make_pos(
6466
6567
6668def get_plot_id (pos : ProofOfSpace ) -> bytes32 :
69+ plot_size = pos .size ()
70+ if plot_size .size_v2 is not None :
71+ assert pos .pool_contract_puzzle_hash is not None
72+ return calculate_plot_id_v2 (pos .pool_contract_puzzle_hash , pos .plot_public_key , plot_size .size_v2 )
73+
6774 assert pos .pool_public_key is None or pos .pool_contract_puzzle_hash is None
6875 if pos .pool_public_key is None :
6976 assert pos .pool_contract_puzzle_hash is not None
@@ -114,6 +121,10 @@ def verify_and_get_quality_string(
114121 return None
115122
116123 plot_size = pos .size ()
124+ if plot_size .size_v2 is not None and pos .pool_contract_puzzle_hash is None :
125+ log .error ("v2 plots require pool_contract_puzzle_hash, pool public key is not supported" )
126+ return None
127+
117128 if not check_plot_size (constants , plot_size ):
118129 return None
119130
@@ -204,6 +215,14 @@ def calculate_pos_challenge(plot_id: bytes32, challenge_hash: bytes32, signage_p
204215 return std_hash (calculate_plot_filter_input (plot_id , challenge_hash , signage_point ))
205216
206217
218+ def calculate_plot_id_v2 (
219+ pool_contract_puzzle_hash : bytes32 ,
220+ plot_public_key : G1Element ,
221+ strength : uint8 ,
222+ ) -> bytes32 :
223+ return std_hash (bytes (pool_contract_puzzle_hash ) + bytes (plot_public_key ) + bytes (strength ))
224+
225+
207226def calculate_plot_id_pk (
208227 pool_public_key : G1Element ,
209228 plot_public_key : G1Element ,
0 commit comments