enhance hasDataColumns condition

This commit is contained in:
Agnish Ghosh 2024-10-11 02:33:58 +05:30
parent 05b1de93bd
commit b92d1dcfbc
1 changed files with 11 additions and 3 deletions

View File

@ -118,6 +118,7 @@ func checkForInitialDcSidecars*(quarantine: DataColumnQuarantine,
func hasDataColumns*(quarantine: DataColumnQuarantine, func hasDataColumns*(quarantine: DataColumnQuarantine,
blck: deneb.SignedBeaconBlock | electra.SignedBeaconBlock): bool = blck: deneb.SignedBeaconBlock | electra.SignedBeaconBlock): bool =
var counter = 0
let let
localSubnetCount = localSubnetCount =
if quarantine.supernode: if quarantine.supernode:
@ -128,6 +129,13 @@ func hasDataColumns*(quarantine: DataColumnQuarantine,
get_custody_columns(quarantine.nodeid, get_custody_columns(quarantine.nodeid,
max(SAMPLES_PER_SLOT.uint64, max(SAMPLES_PER_SLOT.uint64,
localSubnetCount)) localSubnetCount))
if quarantine.supernode:
for i in localCustodyColumns:
if (blck.root, ColumnIndex i) in quarantine.data_columns:
inc counter
if counter >= (NUMBER_OF_COLUMNS div 2):
return true
else:
for i in localCustodyColumns: for i in localCustodyColumns:
if (blck.root, ColumnIndex i) notin quarantine.data_columns: if (blck.root, ColumnIndex i) notin quarantine.data_columns:
return false return false