14
14
from dataclasses import dataclass , replace
15
15
from pathlib import Path
16
16
from random import Random
17
- from typing import Any , Callable , Optional
17
+ from typing import Any , Callable , Optional , Union
18
18
19
19
import anyio
20
20
from chia_puzzles_py .programs import CHIALISP_DESERIALISATION , ROM_BOOTSTRAP_GENERATOR
64
64
from chia .full_node .bundle_tools import simple_solution_generator , simple_solution_generator_backrefs
65
65
from chia .plotting .create_plots import PlotKeys , create_plots
66
66
from chia .plotting .manager import PlotManager
67
+ from chia .plotting .prover import PlotVersion
67
68
from chia .plotting .util import (
68
69
Params ,
69
70
PlotRefreshEvents ,
96
97
generate_taproot_sk ,
97
98
make_pos ,
98
99
passes_plot_filter ,
100
+ quality_for_partial_proof ,
101
+ solve_proof ,
99
102
)
100
103
from chia .types .blockchain_format .serialized_program import SerializedProgram
101
104
from chia .types .blockchain_format .vdf import VDFInfo , VDFProof
@@ -1511,10 +1514,29 @@ def get_pospaces_for_challenge(
1511
1514
if not passes_plot_filter (prefix_bits , plot_id , challenge_hash , signage_point ):
1512
1515
continue
1513
1516
1517
+ # v2 plots aren't valid until after the hard fork
1518
+ if (
1519
+ prev_transaction_b_height < constants .HARD_FORK2_HEIGHT
1520
+ and plot_info .prover .get_version () == PlotVersion .V2
1521
+ ):
1522
+ continue
1523
+
1514
1524
new_challenge : bytes32 = calculate_pos_challenge (plot_id , challenge_hash , signage_point )
1515
- qualities = plot_info .prover .get_qualities_for_challenge (new_challenge , plot_strength )
1516
1525
1517
- for proof_index , quality_str in enumerate (qualities ):
1526
+ # these are either qualities (v1) or partial proofs (v2)
1527
+ proofs : Sequence [Union [bytes32 , bytes ]]
1528
+ v = plot_info .prover .get_version ()
1529
+ if v == PlotVersion .V1 :
1530
+ proofs = plot_info .prover .get_qualities_for_challenge (new_challenge , plot_strength )
1531
+ else :
1532
+ proofs = plot_info .prover .get_partial_proofs_for_challenge (new_challenge , plot_strength )
1533
+
1534
+ for proof_index , proof in enumerate (proofs ):
1535
+ if v == PlotVersion .V2 :
1536
+ quality_str = quality_for_partial_proof (proof , new_challenge )
1537
+ elif v == PlotVersion .V1 :
1538
+ quality_str = bytes32 (proof )
1539
+
1518
1540
required_iters = calculate_iterations_quality (
1519
1541
constants ,
1520
1542
quality_str ,
@@ -1527,7 +1549,11 @@ def get_pospaces_for_challenge(
1527
1549
if required_iters >= calculate_sp_interval_iters (constants , sub_slot_iters ):
1528
1550
continue
1529
1551
1530
- proof_xs : bytes = plot_info .prover .get_full_proof (new_challenge , proof_index )
1552
+ proof_xs : bytes
1553
+ if v == PlotVersion .V1 :
1554
+ proof_xs = plot_info .prover .get_full_proof (new_challenge , proof_index )
1555
+ else :
1556
+ proof_xs = solve_proof (proof )
1531
1557
1532
1558
# Look up local_sk from plot to save locked memory
1533
1559
(
0 commit comments