diff --git a/Connection.js b/Connection.js index 64664172b..990e72315 100644 --- a/Connection.js +++ b/Connection.js @@ -52,7 +52,7 @@ function spec(b) { } this.setupHandlers(); - }; + } Connection.superclass = b.superclass || require('events').EventEmitter; Connection.prototype.setupHandlers = function () { @@ -63,8 +63,8 @@ function spec(b) { var dumpLen = 35; log.debug('['+this.peer+'] '+ 'Recieved '+data.length+' bytes of data:'); - log.debug('... '+ data.slice(0, dumpLen > data.length ? - data.length : dumpLen).toHex() + + log.debug('... '+ buffertools.toHex(data.slice(0, dumpLen > data.length ? + data.length : dumpLen)) + (data.length > dumpLen ? '...' : '')); }).bind(this)); this.socket.addListener('data', this.handleData.bind(this)); diff --git a/ScriptInterpreter.js b/ScriptInterpreter.js index dbe4bb5d7..1af1f5159 100644 --- a/ScriptInterpreter.js +++ b/ScriptInterpreter.js @@ -798,13 +798,13 @@ function spec(b) { ScriptInterpreter.prototype.getPrimitiveStack = function getPrimitiveStack() { return this.stack.map(function (entry) { if (entry.length > 2) { - return entry.slice(0).toHex(); + return buffertools.toHex(entry.slice(0)); } var num = castBigint(entry); if (num.cmp(-128) >= 0 && num.cmp(127) <= 0) { return num.toNumber(); } else { - return entry.slice(0).toHex(); + return buffertools.toHex(entry.slice(0)); } }); }; diff --git a/util/util.js b/util/util.js index e33a67666..4621774d2 100644 --- a/util/util.js +++ b/util/util.js @@ -29,7 +29,6 @@ var sha256ripe160 = exports.sha256ripe160 = function (data) { * Format a block hash like the official client does. */ var formatHash = exports.formatHash = function (hash) { - // Make a copy, because reverse() and toHex() are destructive. var hashEnd = new Buffer(10); hash.copy(hashEnd, 0, 22, 32); return buffertools.reverse(hashEnd).toString('hex'); @@ -39,10 +38,9 @@ var formatHash = exports.formatHash = function (hash) { * Display the whole hash, as hex, in correct endian order. */ var formatHashFull = exports.formatHashFull = function (hash) { - // Make a copy, because reverse() and toHex() are destructive. var copy = new Buffer(hash.length); hash.copy(copy); - var hex = buffertools.reverse(copy).toHex(); + var hex = buffertools.toHex(buffertools.reverse(copy)); return hex; }; @@ -71,7 +69,7 @@ var formatBuffer = exports.formatBuffer = function (buffer, maxLen) { buffer.copy(temp, 0, 0, maxLen); // Format as string - var output = temp.toHex(); + var output = buffertools.toHex(temp); if (temp.length < buffer.length) { output += "..."; }