From 8e81b8914d8c918cb97841029e8a5ffcc3c48b18 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Wed, 17 Feb 2016 04:59:12 -0800 Subject: [PATCH] bad bufferpool. misc. --- lib/bcoin/blockdb.js | 10 ++++++---- lib/bcoin/chaindb.js | 2 ++ lib/bcoin/pool.js | 4 ++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/bcoin/blockdb.js b/lib/bcoin/blockdb.js index 7f10e6a6..10229576 100644 --- a/lib/bcoin/blockdb.js +++ b/lib/bcoin/blockdb.js @@ -336,14 +336,14 @@ BlockDB.prototype.removeBlock = function removeBlock(hash, callback) { if (address) { batch.put('u/a/' + address - + '/' + input.output.hash - + '/' + input.output.index, + + '/' + input.prevout.hash + + '/' + input.prevout.index, coinOffset); } batch.put('u/t/' - + input.output.hash - + '/' + input.output.index, + + input.prevout.hash + + '/' + input.prevout.index, coinOffset); }); @@ -1048,6 +1048,7 @@ BlockData.prototype.closeAsync = function closeAsync(callback) { }; BlockData.prototype._malloc = function _malloc(size) { + return new Buffer(size); if (size > 500) return new Buffer(size); @@ -1063,6 +1064,7 @@ BlockData.prototype._malloc = function _malloc(size) { }; BlockData.prototype._free = function _free(buf) { + return; if (this._bufferPool.used[buf.length] === buf) { assert(this._bufferPool[buf.length] === buf); delete this._bufferPool.used[buf.length]; diff --git a/lib/bcoin/chaindb.js b/lib/bcoin/chaindb.js index cfc4eaa7..8ebd4f45 100644 --- a/lib/bcoin/chaindb.js +++ b/lib/bcoin/chaindb.js @@ -113,6 +113,7 @@ ChainDB.prototype.closeAsync = function closeAsync(callback) { }; ChainDB.prototype._malloc = function _malloc(size) { + return new Buffer(size); if (!this._bufferPool[size]) this._bufferPool[size] = new Buffer(size); @@ -125,6 +126,7 @@ ChainDB.prototype._malloc = function _malloc(size) { }; ChainDB.prototype._free = function _free(buf) { + return; if (this._bufferPool.used[buf.length] === buf) { assert(this._bufferPool[buf.length] === buf); delete this._bufferPool.used[buf.length]; diff --git a/lib/bcoin/pool.js b/lib/bcoin/pool.js index aa2637f3..50a8d9a6 100644 --- a/lib/bcoin/pool.js +++ b/lib/bcoin/pool.js @@ -1607,8 +1607,8 @@ Pool.prototype._nextBlock = function _nextBlock(peer) { return; // item = peer._blockQueue.shift(); - item = peer._blockQueue.slice(0, 250); - peer._blockQueue = peer._blockQueue.slice(250); + item = peer._blockQueue.slice(0, 500); + peer._blockQueue = peer._blockQueue.slice(500); if (peer.destroyed) return;