This commit is contained in:
Agnish Ghosh 2024-10-02 17:49:58 +05:30
parent b9d8699c52
commit 6af7918b78
1 changed files with 26 additions and 26 deletions

View File

@ -201,37 +201,37 @@ proc routeSignedBeaconBlock*(
if dc.index in custody_columns: if dc.index in custody_columns:
dataColumnRefs = Opt.some(dataColumnsOpt[].get().mapIt(newClone(it))) dataColumnRefs = Opt.some(dataColumnsOpt[].get().mapIt(newClone(it)))
debugEcho "Data column refs" debugEcho "Data column refs"
debugEcho dataColumnRefs.get.len debugEcho dataColumnRefs.get.len
let added = await router[].blockProcessor[].addBlock( let added = await router[].blockProcessor[].addBlock(
MsgSource.api, ForkedSignedBeaconBlock.init(blck), blobRefs, dataColumnRefs) MsgSource.api, ForkedSignedBeaconBlock.init(blck), blobRefs, dataColumnRefs)
# The boolean we return tells the caller whether the block was integrated # The boolean we return tells the caller whether the block was integrated
# into the chain # into the chain
if added.isErr(): if added.isErr():
return if added.error() != VerifierError.Duplicate: return if added.error() != VerifierError.Duplicate:
warn "Unable to add routed block to block pool", warn "Unable to add routed block to block pool",
blockRoot = shortLog(blck.root), blck = shortLog(blck.message),
signature = shortLog(blck.signature), err = added.error()
ok(Opt.none(BlockRef))
else:
# If it's duplicate, there's an existing BlockRef to return. The block
# shouldn't be finalized already because that requires a couple epochs
# before occurring, so only check non-finalized resolved blockrefs.
let blockRef = router[].dag.getBlockRef(blck.root)
if blockRef.isErr:
warn "Unable to add routed duplicate block to block pool",
blockRoot = shortLog(blck.root), blck = shortLog(blck.message), blockRoot = shortLog(blck.root), blck = shortLog(blck.message),
signature = shortLog(blck.signature), err = added.error() signature = shortLog(blck.signature), err = added.error()
ok(Opt.none(BlockRef)) ok(blockRef)
else:
# If it's duplicate, there's an existing BlockRef to return. The block
# shouldn't be finalized already because that requires a couple epochs
# before occurring, so only check non-finalized resolved blockrefs.
let blockRef = router[].dag.getBlockRef(blck.root)
if blockRef.isErr:
warn "Unable to add routed duplicate block to block pool",
blockRoot = shortLog(blck.root), blck = shortLog(blck.message),
signature = shortLog(blck.signature), err = added.error()
ok(blockRef)
let blockRef = router[].dag.getBlockRef(blck.root) let blockRef = router[].dag.getBlockRef(blck.root)
if blockRef.isErr: if blockRef.isErr:
warn "Block finalised while waiting for block processor", warn "Block finalised while waiting for block processor",
blockRoot = shortLog(blck.root), blck = shortLog(blck.message), blockRoot = shortLog(blck.root), blck = shortLog(blck.message),
signature = shortLog(blck.signature) signature = shortLog(blck.signature)
ok(blockRef) ok(blockRef)
proc routeAttestation*( proc routeAttestation*(
router: ref MessageRouter, router: ref MessageRouter,