From bdcd206345d1cb277f84e92ebc7315b63af877ac Mon Sep 17 00:00:00 2001 From: Jan Segre Date: Thu, 2 Oct 2025 02:11:24 +0200 Subject: [PATCH] feat(block-template): shuffle possible tx-parents to avoid bias --- hathor/manager.py | 1 + 1 file changed, 1 insertion(+) diff --git a/hathor/manager.py b/hathor/manager.py index 26b9a8c49..4ab9ec23e 100644 --- a/hathor/manager.py +++ b/hathor/manager.py @@ -732,6 +732,7 @@ def _make_block_template(self, parent_block: Block, parent_txs: 'ParentTxs', cur if __debug__ and len(parents) == 3: assert len(parents_any) == 0, 'Extra parents to choose from that cannot be chosen' score = parent_block_metadata.score + weight_to_work(weight) + self.rng.shuffle(parents_any) # shuffle parents_any to get rid of biases if clients don't shuffle themselves return BlockTemplate( versions={TxVersion.REGULAR_BLOCK.value, TxVersion.MERGE_MINED_BLOCK.value}, reward=self.daa.get_tokens_issued_per_block(height),