diff --git a/lib/replicator.js b/lib/replicator.js index 1b4af3a3..6be5dff4 100644 --- a/lib/replicator.js +++ b/lib/replicator.js @@ -1842,6 +1842,8 @@ module.exports = class Replicator { const blocks = new Map() for (const b of this._blocks) { + if (this.core.bitfield.get(b.index) === false) continue + const request = this.core.blocks.get(reader, b.index) blocks.set(b, request) @@ -1851,8 +1853,6 @@ module.exports = class Replicator { reader.tryFlush() for (const [b, request] of blocks) { - if (this.core.bitfield.get(b.index) === false) continue - try { b.resolve(await request) } catch (err) {