Skip to content

Commit 99a3a94

Browse files
committed
after the hard fork, disallow block references
1 parent 8c50242 commit 99a3a94

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

chia/consensus/block_body_validation.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,10 +341,14 @@ async def validate_block_body(
341341
# the generator ref list for this block (or 'one' bytes [0x01] if no generator)
342342
# 8b. The generator ref list length must be less than or equal to MAX_GENERATOR_REF_LIST_SIZE entries
343343
# 8c. The generator ref list must not point to a height >= this block's height
344-
if block.transactions_generator_ref_list in (None, []):
344+
if block.transactions_generator_ref_list == []:
345345
if block.transactions_info.generator_refs_root != bytes([1] * 32):
346346
return Err.INVALID_TRANSACTIONS_GENERATOR_REFS_ROOT
347347
else:
348+
# With hard fork 2 we ban transactions_generator_ref_list.
349+
if prev_transaction_block_height >= constants.HARD_FORK2_HEIGHT:
350+
return Err.TOO_MANY_GENERATOR_REFS
351+
348352
# If we have a generator reference list, we must have a generator
349353
if block.transactions_generator is None:
350354
return Err.INVALID_TRANSACTIONS_GENERATOR_REFS_ROOT

chia/simulator/block_tools.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,10 @@ def setup_new_gen(
385385
transaction_data: Optional[SpendBundle],
386386
block_refs: list[uint32],
387387
) -> Optional[NewBlockGenerator]:
388+
if prev_tx_height >= self.constants.HARD_FORK2_HEIGHT:
389+
assert block_refs == [], "block references are not allowed after hard fork 2"
390+
dummy_block_references = False
391+
388392
# we don't know if the new block will be a transaction
389393
# block or not, so even though we prepare a block
390394
# generator, we can't update our state (like,

0 commit comments

Comments
 (0)