parser: minor.
This commit is contained in:
parent
58a5372b09
commit
2881294bf4
@ -131,14 +131,15 @@ Parser.prototype.parse = function parse(data) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
checksum = crypto.checksum(data).readUInt32LE(0, true);
|
checksum = crypto.hash256(data).readUInt32LE(0, true);
|
||||||
|
|
||||||
if (checksum !== this.header.checksum) {
|
if (checksum !== this.header.checksum) {
|
||||||
this.waiting = 24;
|
this.waiting = 24;
|
||||||
this.header = null;
|
this.header = null;
|
||||||
return this.error(
|
return this.error(
|
||||||
'Invalid checksum: %d != %d',
|
'Invalid checksum: %d != %d',
|
||||||
checksum, this.header.checksum);
|
utils.hex32(checksum),
|
||||||
|
utils.hex32(this.header.checksum));
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -167,7 +168,7 @@ Parser.prototype.parseHeader = function parseHeader(data) {
|
|||||||
magic = data.readUInt32LE(0, true);
|
magic = data.readUInt32LE(0, true);
|
||||||
|
|
||||||
if (magic !== this.network.magic)
|
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
|
// Count length of the cmd
|
||||||
for (i = 0; data[i + 4] !== 0 && i < 12; i++);
|
for (i = 0; data[i + 4] !== 0 && i < 12; i++);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user