diff --git a/lib/bcoin/protocol/parser.js b/lib/bcoin/protocol/parser.js index 029d4704..7cf7035a 100644 --- a/lib/bcoin/protocol/parser.js +++ b/lib/bcoin/protocol/parser.js @@ -57,8 +57,6 @@ 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; @@ -83,8 +81,7 @@ Parser.prototype.parse = function parse(chunk) { if (readU32(utils.checksum(this.packet.payload)) !== this.packet.checksum) return this._error('Invalid checksum'); - this.packet.payload = this.parsePayload(this.packet.cmd, - this.packet.payload); + this.packet.payload = this.parsePayload(this.packet.cmd, this.packet.payload); if (this.packet.payload) this.emit('packet', this.packet);