From 2881294bf4c3cfd3b9f209e44c863eec0b9799e9 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Fri, 16 Sep 2016 19:32:48 -0700 Subject: [PATCH] parser: minor. --- lib/net/parser.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/net/parser.js b/lib/net/parser.js index 1db15fb5..81501b99 100644 --- a/lib/net/parser.js +++ b/lib/net/parser.js @@ -131,14 +131,15 @@ Parser.prototype.parse = function parse(data) { return; } - checksum = crypto.checksum(data).readUInt32LE(0, true); + checksum = crypto.hash256(data).readUInt32LE(0, true); if (checksum !== this.header.checksum) { this.waiting = 24; this.header = null; return this.error( 'Invalid checksum: %d != %d', - checksum, this.header.checksum); + utils.hex32(checksum), + utils.hex32(this.header.checksum)); } try { @@ -167,7 +168,7 @@ Parser.prototype.parseHeader = function parseHeader(data) { magic = data.readUInt32LE(0, true); if (magic !== this.network.magic) - return this.error('Invalid magic value: %s.', magic.toString(16)); + return this.error('Invalid magic value: %s.', utils.hex32(magic)); // Count length of the cmd for (i = 0; data[i + 4] !== 0 && i < 12; i++);