|
33 | 33 | from chia.consensus.find_fork_point import lookup_fork_chain |
34 | 34 | from chia.consensus.full_block_to_block_record import block_to_block_record |
35 | 35 | from chia.consensus.generator_tools import get_block_header |
| 36 | +from chia.consensus.get_block_challenge import prev_tx_block |
36 | 37 | from chia.consensus.get_block_generator import get_block_generator |
37 | 38 | from chia.consensus.multiprocess_validation import PreValidationResult |
38 | 39 | from chia.full_node.block_store import BlockStore |
@@ -698,12 +699,16 @@ async def validate_unfinished_block_header( |
698 | 699 | if len(block.transactions_generator_ref_list) > self.constants.MAX_GENERATOR_REF_LIST_SIZE: |
699 | 700 | return None, Err.TOO_MANY_GENERATOR_REFS |
700 | 701 |
|
701 | | - if ( |
702 | | - self.try_block_record(block.prev_header_hash) is None |
703 | | - and block.prev_header_hash != self.constants.GENESIS_CHALLENGE |
704 | | - ): |
| 702 | + prev_b = self.try_block_record(block.prev_header_hash) |
| 703 | + if prev_b is None and block.prev_header_hash != self.constants.GENESIS_CHALLENGE: |
705 | 704 | return None, Err.INVALID_PREV_BLOCK_HASH |
706 | 705 |
|
| 706 | + prev_tx_height = prev_tx_block(self, prev_b) |
| 707 | + |
| 708 | + # With hard fork 2 we ban transactions_generator_ref_list. |
| 709 | + if prev_tx_height >= self.constants.HARD_FORK2_HEIGHT and block.transactions_generator_ref_list != []: |
| 710 | + return None, Err.TOO_MANY_GENERATOR_REFS |
| 711 | + |
707 | 712 | if block.transactions_info is not None: |
708 | 713 | if block.transactions_generator is not None: |
709 | 714 | if std_hash(bytes(block.transactions_generator)) != block.transactions_info.generator_root: |
|
0 commit comments