include data columns in addBlock that care about custody

This commit is contained in:
Agnish Ghosh 2024-08-28 18:53:28 +05:30
parent 66cb3ff54e
commit 07d1a26e59
2 changed files with 13 additions and 7 deletions

View File

@ -700,12 +700,12 @@ proc storeBlock(
for b in blobs:
self.consensusManager.dag.db.putBlobSidecar(b[])
# # write data columns now that block has been written.
# let data_columns = dataColumnsOpt.valueOr: DataColumnSidecars @[]
# for c in data_columns:
# self.consensusManager.dag.db.putDataColumnSidecar(c[])
# debug "Data column written to database!",
# data_column = shortLog(c[])
# write data columns now that block has been written.
let data_columns = dataColumnsOpt.valueOr: DataColumnSidecars @[]
for c in data_columns:
self.consensusManager.dag.db.putDataColumnSidecar(c[])
debug "Data column written to database!",
data_column = shortLog(c[])
let addHeadBlockTick = Moment.now()

View File

@ -208,7 +208,13 @@ proc routeSignedBeaconBlock*(
data_column = shortLog(data_columns[i]), error = res.error[]
else:
notice "Data columns sent", data_column = shortLog(dataColumnsOpt[].get()[i])
dataColumnRefs = Opt.some(dataColumnsOpt[].get().mapIt(newClone(it)))
let
metadata = router[].network.metadata.custody_subnet_count.uint64
custody_columns = router[].network.nodeId.get_custody_columns(metadata)
for dc in data_columns:
if dc.index in custody_columns.get:
let dataColumnRefs = Opt.some(dataColumnsOpt[].get().mapIt(newClone(it)))
let added = await router[].blockProcessor[].addBlock(
MsgSource.api, ForkedSignedBeaconBlock.init(blck), blobRefs, dataColumnRefs)