Skip to content
Snippets Groups Projects
Commit 2b1cf691 authored by Cédric Moreau's avatar Cédric Moreau
Browse files

[fix] sync: filter on *wanted* blocks

parent 4795582d
No related branches found
No related tags found
No related merge requests found
...@@ -93,7 +93,7 @@ export class ChunkGetter { ...@@ -93,7 +93,7 @@ export class ChunkGetter {
} }
// Download loop // Download loop
(async () => { return (async () => {
let downloadFinished = false let downloadFinished = false
while(!downloadFinished) { while(!downloadFinished) {
...@@ -233,7 +233,12 @@ export class ChunkGetter { ...@@ -233,7 +233,12 @@ export class ChunkGetter {
} }
async getChunk(i: number): Promise<PromiseOfBlocksReading> { async getChunk(i: number): Promise<PromiseOfBlocksReading> {
return this.resultsData[i] || Promise.resolve(async (): Promise<BlockDTO[]> => []) const reading = this.resultsData[i] || Promise.resolve(async (): Promise<BlockDTO[]> => [])
// We don't want blocks above `to`
return async () => {
const blocks = await (await reading)()
return blocks.filter(b => b.number <= this.to)
}
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment