conditionally reconstruct and broadcast only when supernode
This commit is contained in:
parent
cc21a2a630
commit
f3f61cbbff
|
@ -1512,25 +1512,24 @@ proc tryReconstructingDataColumns* (self: BeaconNode,
|
||||||
# storedColumn number is less than the NUMBER_OF_COLUMNS
|
# storedColumn number is less than the NUMBER_OF_COLUMNS
|
||||||
# then reconstruction is not possible, and if all the data columns
|
# then reconstruction is not possible, and if all the data columns
|
||||||
# are already stored then we do not need to reconstruct at all
|
# are already stored then we do not need to reconstruct at all
|
||||||
if storedColumns.len < NUMBER_OF_COLUMNS or storedColumns.len == NUMBER_OF_COLUMNS:
|
if storedColumns.len < NUMBER_OF_COLUMNS div 2 or storedColumns.len == NUMBER_OF_COLUMNS:
|
||||||
return ok()
|
return ok()
|
||||||
else:
|
else:
|
||||||
return err("DataColumnSidecar: Reconstruction error!")
|
|
||||||
|
|
||||||
# Recover blobs from saved data column sidecars
|
# Recover blobs from saved data column sidecars
|
||||||
let recovered_cps = recover_cells_and_proofs(data_column_sidecars, storedColumns.len, signed_block)
|
let recovered_cps = recover_cells_and_proofs(data_column_sidecars, storedColumns.len, signed_block)
|
||||||
if not recovered_cps.isOk:
|
if not recovered_cps.isOk:
|
||||||
return err("Error recovering cells and proofs from data columns")
|
return err("Error recovering cells and proofs from data columns")
|
||||||
|
|
||||||
# Reconstruct data column sidecars from recovered blobs
|
# Reconstruct data column sidecars from recovered blobs
|
||||||
let reconstructedDataColumns = get_data_column_sidecars(signed_block, recovered_cps.get)
|
let reconstructedDataColumns = get_data_column_sidecars(signed_block, recovered_cps.get)
|
||||||
|
|
||||||
for data_column in reconstructedDataColumns.get:
|
for data_column in reconstructedDataColumns.get:
|
||||||
if data_column.index notin custodiedColumnIndices.get:
|
if data_column.index notin custodiedColumnIndices.get:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
db.putDataColumnSidecar(data_column)
|
db.putDataColumnSidecar(data_column)
|
||||||
notice "Data Column Reconstructed and Saved Successfully"
|
notice "Data Column Reconstructed and Saved Successfully"
|
||||||
|
|
||||||
ok()
|
ok()
|
||||||
|
|
||||||
|
@ -1543,7 +1542,7 @@ proc reconstructAndSendDataColumns*(node: BeaconNode) {.async.} =
|
||||||
withBlck(blck):
|
withBlck(blck):
|
||||||
when typeof(forkyBlck).kind < ConsensusFork.Deneb: return
|
when typeof(forkyBlck).kind < ConsensusFork.Deneb: return
|
||||||
else:
|
else:
|
||||||
let res = node.tryReconstructingDataColumns(forkyblck)
|
let res = node.tryReconstructingDataColumns(forkyBlck)
|
||||||
if not res.isOk():
|
if not res.isOk():
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -1583,7 +1582,8 @@ proc onSlotEnd(node: BeaconNode, slot: Slot) {.async.} =
|
||||||
# Things we do when slot processing has ended and we're about to wait for the
|
# Things we do when slot processing has ended and we're about to wait for the
|
||||||
# next slot
|
# next slot
|
||||||
|
|
||||||
await node.reconstructAndSendDataColumns()
|
if node.config.subscribeAllSubnets:
|
||||||
|
await node.reconstructAndSendDataColumns()
|
||||||
|
|
||||||
# By waiting until close before slot end, ensure that preparation for next
|
# By waiting until close before slot end, ensure that preparation for next
|
||||||
# slot does not interfere with propagation of messages and with VC duties.
|
# slot does not interfere with propagation of messages and with VC duties.
|
||||||
|
|
Loading…
Reference in New Issue