parser: minor.

This commit is contained in:
Christopher Jeffrey 2016-09-16 19:32:48 -07:00
parent 58a5372b09
commit 2881294bf4
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -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++);