Fix beacon_sync mapBodiesToHeader bug (#2355)

This commit is contained in:
andri lim 2024-06-14 17:41:58 +07:00 committed by GitHub
parent 0f53d11b52
commit 5784945650
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 1 deletions

View File

@ -81,8 +81,14 @@ proc mapBodiesToHeader(buddy: BeaconBuddyRef,
job: BeaconJob,
bodies: openArray[BlockBody],
reqBodies: openArray[bool]) {.raises: [].} =
doAssert(job.mode == bjmGetBlocks or
job.mode == bjmGetBodies,
"mapBodiesToHeader doesn't allow this job: " & $job.mode)
var
headers = system.move(job.getBlocksJob.headers)
headers = if job.mode == bjmGetBlocks:
system.move(job.getBlocksJob.headers)
else:
system.move(job.getBodiesJob.headers)
map = Table[Hash256, int]()
for i, x in bodies: