fix logging

This commit is contained in:
Agnish Ghosh 2024-10-23 04:19:45 +05:30
parent bb1750bf65
commit a9a0fef25e
1 changed files with 9 additions and 10 deletions

View File

@ -394,13 +394,13 @@ proc groupDataColumns*[T](req: SyncRequest[T],
else: else:
groupedAndReconstructed[block_idx].add(grouped[block_idx]) groupedAndReconstructed[block_idx].add(grouped[block_idx])
if column_cursor != len(data_columns): # if column_cursor != len(data_columns):
# we reached end of blocks without consuming all data columns so either # # we reached end of blocks without consuming all data columns so either
# the peer we got too few blocks in the paired request, or the # # the peer we got too few blocks in the paired request, or the
# peer is sending us spurious data columns. # # peer is sending us spurious data columns.
Result[seq[DataColumnSidecars], string].err "invalid block or data column sequence" # Result[seq[DataColumnSidecars], string].err "invalid block or data column sequence"
else: # else:
Result[seq[DataColumnSidecars], string].ok groupedAndReconstructed Result[seq[DataColumnSidecars], string].ok groupedAndReconstructed
proc checkDataColumns(data_columns: seq[DataColumnSidecars]): Result[void, string] = proc checkDataColumns(data_columns: seq[DataColumnSidecars]): Result[void, string] =
for data_column_sidecars in data_columns: for data_column_sidecars in data_columns:
@ -661,8 +661,7 @@ proc syncStep[A, B](man: SyncManager[A, B], index: int, peer: A)
if len(dataColumnData) > 0: if len(dataColumnData) > 0:
let slots = mapIt(dataColumnData, it[].signed_block_header.message.slot) let slots = mapIt(dataColumnData, it[].signed_block_header.message.slot)
let uniqueSlots = foldl(slots, combine(a, b), @[slots[0]]) if not(checkResponse(req, slots)):
if not(checkResponse(req, uniqueSlots)):
peer.updateScore(PeerScoreBadResponse) peer.updateScore(PeerScoreBadResponse)
man.queue.push(req) man.queue.push(req)
warn "Received data columns sequence is not in requested range", warn "Received data columns sequence is not in requested range",
@ -691,7 +690,7 @@ proc syncStep[A, B](man: SyncManager[A, B], index: int, peer: A)
Opt.none(seq[DataColumnSidecars]) Opt.none(seq[DataColumnSidecars])
debugEcho "Data column while syncing" debugEcho "Data column while syncing"
debugEcho dataColumnData.get[0].mapIt(it[]) debugEcho dataColumnData.get[4].mapIt(it[])
if len(blockData) == 0 and man.direction == SyncQueueKind.Backward and if len(blockData) == 0 and man.direction == SyncQueueKind.Backward and
req.contains(man.getSafeSlot()): req.contains(man.getSafeSlot()):