From 329fc21eabf047d030a890110ecd0e90ce6de838 Mon Sep 17 00:00:00 2001 From: Agnish Ghosh Date: Mon, 29 Jul 2024 19:00:43 +0530 Subject: [PATCH] add: condition for being able to selfReconstruct --- beacon_chain/spec/eip7594_helpers.nim | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/beacon_chain/spec/eip7594_helpers.nim b/beacon_chain/spec/eip7594_helpers.nim index 38b6e5e63..20c94431c 100644 --- a/beacon_chain/spec/eip7594_helpers.nim +++ b/beacon_chain/spec/eip7594_helpers.nim @@ -338,3 +338,14 @@ func verify_data_column_sidecar_inclusion_proof*(sidecar: DataColumnSidecar): Re return err("DataColumnSidecar: inclusion proof not valid") ok() + +proc selfReconstructDataColumns*(numCol: uint64): + bool = + # This function tells whether data columns can be + # reconstructed or not + const totalColumns = NUMBER_OF_COLUMNS.uint64 + let + columnsNeeded = totalColumns div 2 + totalColumns mod 2 + if numCol >= columnsNeeded: + return true + false