Skip to content

Commit 8b49b06

Browse files
authored
Block tools indentation (#19957)
improve indentation of get_pospaces_for_challenge()
1 parent 35291ee commit 8b49b06

File tree

1 file changed

+42
-38
lines changed

1 file changed

+42
-38
lines changed

chia/simulator/block_tools.py

Lines changed: 42 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1505,46 +1505,50 @@ def get_pospaces_for_challenge(
15051505
if force_plot_id is not None and plot_id != force_plot_id:
15061506
continue
15071507
prefix_bits = calculate_prefix_bits(constants, height, plot_info.prover.get_size())
1508-
if passes_plot_filter(prefix_bits, plot_id, challenge_hash, signage_point):
1509-
new_challenge: bytes32 = calculate_pos_challenge(plot_id, challenge_hash, signage_point)
1510-
qualities = plot_info.prover.get_qualities_for_challenge(new_challenge)
1508+
if not passes_plot_filter(prefix_bits, plot_id, challenge_hash, signage_point):
1509+
continue
15111510

1512-
for proof_index, quality_str in enumerate(qualities):
1513-
required_iters = calculate_iterations_quality(
1514-
constants,
1515-
quality_str,
1516-
plot_info.prover.get_size(),
1517-
difficulty,
1518-
signage_point,
1519-
sub_slot_iters,
1520-
prev_transaction_b_height,
1521-
)
1522-
if required_iters < calculate_sp_interval_iters(constants, sub_slot_iters):
1523-
proof_xs: bytes = plot_info.prover.get_full_proof(new_challenge, proof_index)
1511+
new_challenge: bytes32 = calculate_pos_challenge(plot_id, challenge_hash, signage_point)
1512+
qualities = plot_info.prover.get_qualities_for_challenge(new_challenge)
15241513

1525-
# Look up local_sk from plot to save locked memory
1526-
(
1527-
pool_public_key_or_puzzle_hash,
1528-
farmer_public_key,
1529-
local_master_sk,
1530-
) = parse_plot_info(plot_info.prover.get_memo())
1531-
local_sk = master_sk_to_local_sk(local_master_sk)
1532-
1533-
if isinstance(pool_public_key_or_puzzle_hash, G1Element):
1534-
include_taproot = False
1535-
else:
1536-
assert isinstance(pool_public_key_or_puzzle_hash, bytes32)
1537-
include_taproot = True
1538-
plot_pk = generate_plot_public_key(local_sk.get_g1(), farmer_public_key, include_taproot)
1539-
proof_of_space: ProofOfSpace = make_pos(
1540-
new_challenge,
1541-
plot_info.pool_public_key,
1542-
plot_info.pool_contract_puzzle_hash,
1543-
plot_pk,
1544-
plot_info.prover.get_size(),
1545-
proof_xs,
1546-
)
1547-
found_proofs.append((required_iters, proof_of_space))
1514+
for proof_index, quality_str in enumerate(qualities):
1515+
required_iters = calculate_iterations_quality(
1516+
constants,
1517+
quality_str,
1518+
plot_info.prover.get_size(),
1519+
difficulty,
1520+
signage_point,
1521+
sub_slot_iters,
1522+
prev_transaction_b_height,
1523+
)
1524+
if required_iters >= calculate_sp_interval_iters(constants, sub_slot_iters):
1525+
continue
1526+
1527+
proof_xs: bytes = plot_info.prover.get_full_proof(new_challenge, proof_index)
1528+
1529+
# Look up local_sk from plot to save locked memory
1530+
(
1531+
pool_public_key_or_puzzle_hash,
1532+
farmer_public_key,
1533+
local_master_sk,
1534+
) = parse_plot_info(plot_info.prover.get_memo())
1535+
local_sk = master_sk_to_local_sk(local_master_sk)
1536+
1537+
if isinstance(pool_public_key_or_puzzle_hash, G1Element):
1538+
include_taproot = False
1539+
else:
1540+
assert isinstance(pool_public_key_or_puzzle_hash, bytes32)
1541+
include_taproot = True
1542+
plot_pk = generate_plot_public_key(local_sk.get_g1(), farmer_public_key, include_taproot)
1543+
proof_of_space: ProofOfSpace = make_pos(
1544+
new_challenge,
1545+
plot_info.pool_public_key,
1546+
plot_info.pool_contract_puzzle_hash,
1547+
plot_pk,
1548+
plot_info.prover.get_size(),
1549+
proof_xs,
1550+
)
1551+
found_proofs.append((required_iters, proof_of_space))
15481552
random_sample = found_proofs
15491553
if len(found_proofs) >= 1:
15501554
if rng.random() < 0.1:

0 commit comments

Comments
 (0)