Skip to content

Commit af756f3

Browse files
committed
Simplify getMissingSidecarIndices(columns).
1 parent d01bb65 commit af756f3

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

beacon_chain/consensus_object_pools/blob_quarantine.nim

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -728,26 +728,18 @@ func getMissingSidecarIndices*(
728728
# Fast-path if block does not have any columns
729729
return res
730730

731-
let supernode = (len(quarantine.custodyColumns) == NUMBER_OF_COLUMNS)
732-
if supernode:
731+
if (len(quarantine.custodyColumns) == NUMBER_OF_COLUMNS):
733732
if len(record.sidecars) > NUMBER_OF_COLUMNS div 2:
734733
return res
735-
if len(record.sidecars) == 0:
736-
for index in 0 ..< NUMBER_OF_COLUMNS:
734+
for index in 0 ..< NUMBER_OF_COLUMNS:
735+
if (len(record.sidecars) == 0) or record.sidecars[index].isEmpty():
737736
res.add(ColumnIndex(index))
738-
else:
739-
for index in 0 ..< NUMBER_OF_COLUMNS:
740-
if record.sidecars[index].isEmpty():
741-
res.add(ColumnIndex(index))
742737
else:
743-
if len(record.sidecars) == 0:
744-
for column in quarantine.custodyMap.items():
738+
for column in quarantine.custodyMap.items():
739+
let index = quarantine.getIndex(column)
740+
if (len(record.sidecars) == 0) or (index == -1) or
741+
record.sidecars[index].isEmpty():
745742
res.add(column)
746-
else:
747-
for column in quarantine.custodyMap.items():
748-
let index = quarantine.getIndex(column)
749-
if (index == -1) or (record.sidecars[index].isEmpty()):
750-
res.add(column)
751743
res
752744

753745
proc pruneAfterFinalization*(

0 commit comments

Comments
 (0)