Skip to content

Commit 78d1f92

Browse files
committed
address review comments
1 parent 05631d1 commit 78d1f92

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

chia/full_node/weight_proof.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1367,14 +1367,17 @@ def __validate_pospace(
13671367
# validate proof of space
13681368
assert sub_slot_data.proof_of_space is not None
13691369

1370+
# when sampling blocks as part of weight proof validation, the previous
1371+
# transaction height is a conservative estimate, since we don't have direct
1372+
# access to it.
13701373
required_iters = validate_pospace_and_get_required_iters(
13711374
constants,
13721375
sub_slot_data.proof_of_space,
13731376
challenge,
13741377
cc_sp_hash,
13751378
height,
13761379
curr_diff,
1377-
uint32(0), # prev_tx_block(blocks, prev_b), todo need to get height of prev tx block somehow here
1380+
uint32(max(0, height - constants.MAX_SUB_SLOT_BLOCKS)),
13781381
)
13791382
if required_iters is None:
13801383
log.error("could not verify proof of space")

chia/types/blockchain_format/proof_of_space.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,6 @@ def is_v1_phased_out(
109109
return proof_value > epoch_counter
110110

111111

112-
# TODO: the "height" parameter is a bit suspect. It can probably be removed in
113-
# favor of prev_transaction_block_height
114112
def verify_and_get_quality_string(
115113
pos: ProofOfSpace,
116114
constants: ConsensusConstants,
@@ -123,6 +121,7 @@ def verify_and_get_quality_string(
123121
plot_size = pos.size()
124122

125123
if plot_size.size_v1 is not None and is_v1_phased_out(pos.proof, prev_transaction_block_height, constants):
124+
log.info("v1 proof has been phased-out and is no longer valid")
126125
return None
127126

128127
# Exactly one of (pool_public_key, pool_contract_puzzle_hash) must not be None

0 commit comments

Comments
 (0)