diff --git a/lib/replicator.js b/lib/replicator.js index 510ab2da..a8f8f9ce 100644 --- a/lib/replicator.js +++ b/lib/replicator.js @@ -1189,7 +1189,7 @@ class Peer { } _requestBlock (b) { - const { length, fork } = this.core.tree + const { prologue, length, fork } = this.core.tree if (this._remoteHasBlock(b.index) === false || fork !== this.remoteFork) { this._maybeWant(b.index) @@ -1200,7 +1200,9 @@ class Peer { return false } - const req = this._makeRequest(b.index >= length, b.priority, b.index + 1) + const treeLength = (prologue && prologue.length > length) ? prologue.length : length + + const req = this._makeRequest(b.index >= treeLength, b.priority, b.index + 1) if (req === null) return false this._sendBlockRequest(req, b)