allow syncing capella blocks (#4423)

This commit is contained in:
Jacek Sieka 2022-12-14 02:30:34 +01:00 committed by GitHub
parent cd993ca418
commit 2440954555
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -804,7 +804,7 @@ func chunkMaxSize[T](): uint32 =
when T is ForkySignedBeaconBlock:
when T is phase0.SignedBeaconBlock or T is altair.SignedBeaconBlock:
MAX_CHUNK_SIZE
elif T is bellatrix.SignedBeaconBlock:
elif T is bellatrix.SignedBeaconBlock or T is capella.SignedBeaconBlock:
MAX_CHUNK_SIZE_BELLATRIX
else:
{.fatal: "what's the chunk size here?".}

View File

@ -14,7 +14,7 @@ import
std/[options, tables, sets, macros],
chronicles, chronos, snappy/codec,
libp2p/switch,
../spec/datatypes/[phase0, altair, bellatrix],
../spec/datatypes/[phase0, altair, bellatrix, capella],
../spec/[helpers, forks, network],
".."/[beacon_clock],
../networking/eth2_network,
@ -106,6 +106,12 @@ proc readChunkPayload*(
return ok newClone(ForkedSignedBeaconBlock.init(res.get))
else:
return err(res.error)
elif contextBytes == peer.network.forkDigests.capella:
let res = await readChunkPayload(conn, peer, capella.SignedBeaconBlock)
if res.isOk:
return ok newClone(ForkedSignedBeaconBlock.init(res.get))
else:
return err(res.error)
else:
return neterr InvalidContextBytes