release the memory a bit sooner

This commit is contained in:
Ștefan Talpalaru 2019-03-31 22:38:21 +02:00
parent dcb82f6a96
commit 7954c0c7ed
No known key found for this signature in database
GPG Key ID: CBF7934204F1B6F9
1 changed files with 5 additions and 4 deletions

View File

@ -55,8 +55,9 @@ proc availableWorkItem(ctx: SyncContext): int =
else:
discard
let eb = ctx.workQueue[i].endIndex
if eb > maxPendingBlock: maxPendingBlock = eb
let endBlock = ctx.workQueue[i].endIndex
if endBlock > maxPendingBlock:
maxPendingBlock = endBlock
let nextRequestedBlock = maxPendingBlock + 1
if nextRequestedBlock >= ctx.endBlockNumber:
@ -79,8 +80,8 @@ proc persistWorkItem(ctx: SyncContext, wi: var WantedBlocks) =
of ValidationResult.Error:
wi.state = Initial
# successful or not, we're done with these blocks
wi.headers.setLen(0)
wi.bodies.setLen(0)
wi.headers = @[]
wi.bodies = @[]
proc persistPendingWorkItems(ctx: SyncContext) =
var nextStartIndex = ctx.finalizedBlock + 1