use native buffer methods if possible.

This commit is contained in:
Christopher Jeffrey 2016-03-26 06:11:58 -07:00
parent 661bd06e3e
commit 85af68d2ef
2 changed files with 12 additions and 2 deletions

View File

@ -97,6 +97,7 @@ Fullnode.prototype._init = function _init() {
self.emit('error', err);
});
if (0)
this.on('tx', function(tx) {
self.walletdb.addTX(tx, function(err) {
if (err)
@ -117,6 +118,7 @@ Fullnode.prototype._init = function _init() {
});
// Update the mempool.
if (0)
this.chain.on('add block', function(block) {
self.mempool.addBlock(block, function(err) {
if (err)
@ -124,6 +126,7 @@ Fullnode.prototype._init = function _init() {
});
});
if (0)
this.chain.on('remove block', function(block) {
self.mempool.removeBlock(block, function(err) {
if (err)

View File

@ -420,6 +420,9 @@ utils.isEqual = function isEqual(a, b) {
if (a.length !== b.length)
return false;
if (a.compare)
return a.compare(b) === 0;
for (i = 0; i < a.length; i++) {
if (a[i] !== b[i])
return false;
@ -1520,8 +1523,12 @@ utils.sizeVarint = function sizeVarint(num) {
};
utils.cmp = function(a, b) {
var len = Math.min(a.length, b.length);
var i;
var len, i;
if (a.compare)
return a.compare(b);
len = Math.min(a.length, b.length);
for (i = 0; i < len; i++) {
if (a[i] < b[i])