diff --git a/lib/bcoin/protocol/parser.js b/lib/bcoin/protocol/parser.js index f677ad8c..7af43d09 100644 --- a/lib/bcoin/protocol/parser.js +++ b/lib/bcoin/protocol/parser.js @@ -38,6 +38,8 @@ Parser.prototype.feed = function feed(data) { len = utils.copy(this.pending[0], chunk, off); if (len === this.pending[0].length) this.pending.shift(); + else if (!this.pending[0].slice && this.pending[0] instanceof Uint8Array) + this.pending[0] = new Uint8Array(this.pending[0].buffer.slice(len)); else this.pending[0] = this.pending[0].slice(len); off += len;