Skip to content

Commit

Permalink
Addressing comments
Browse files Browse the repository at this point in the history
  • Loading branch information
asdacap committed Dec 12, 2024
1 parent fb9833f commit e713a2a
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -511,16 +511,12 @@ private void EnqueueBatch(HeadersSyncBatch batch)
lastHeader = nextHeader;
}

ArrayPoolList<BlockHeader> reversedBatch = new ArrayPoolList<BlockHeader>(headers.Count);
foreach (BlockHeader blockHeader in headers.Reverse())
{
reversedBatch.Add(blockHeader);
}
headers.AsSpan().Reverse();

using HeadersSyncBatch newBatchToProcess = new HeadersSyncBatch();
newBatchToProcess.StartNumber = lastHeader.Number;
newBatchToProcess.RequestSize = headers.Count;
newBatchToProcess.Response = reversedBatch;
newBatchToProcess.Response = headers;
if (_logger.IsDebug) _logger.Debug($"Handling header portion {newBatchToProcess.StartNumber} to {newBatchToProcess.EndNumber} with persisted headers.");
InsertHeaders(newBatchToProcess);

Expand Down Expand Up @@ -681,6 +677,7 @@ protected virtual int InsertHeaders(HeadersSyncBatch batch)
HeadersSyncQueueReport.Update(HeadersInQueue);
return added;

// Well, its the last in the batch, but first processed.
bool ValidateFirstHeader(BlockHeader header)
{
BlockHeader lowestInserted = LowestInsertedBlockHeader;
Expand Down

0 comments on commit e713a2a

Please sign in to comment.