Removed unneeded indexes.
This commit is contained in:
parent
765b7288a7
commit
00a5ea65b4
@ -363,7 +363,7 @@ AddressService.prototype.stop = function(callback) {
|
|||||||
|
|
||||||
AddressService.prototype._getTxidStream = function(address, options) {
|
AddressService.prototype._getTxidStream = function(address, options) {
|
||||||
|
|
||||||
var start = this._encoding.encodeAddressIndexKey(address, options.start);
|
var start = this._encoding.encodeAddressIndexKey(address);
|
||||||
var end = Buffer.concat([
|
var end = Buffer.concat([
|
||||||
start.slice(0, address.length + 4),
|
start.slice(0, address.length + 4),
|
||||||
options.endHeightBuf,
|
options.endHeightBuf,
|
||||||
@ -470,7 +470,6 @@ AddressService.prototype._getAddressTxHistory = function(options, callback) {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// main api function for insight-api/bws
|
|
||||||
AddressService.prototype._getAddressTxidHistory = function(address, options, callback) {
|
AddressService.prototype._getAddressTxidHistory = function(address, options, callback) {
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
@ -709,9 +708,7 @@ AddressService.prototype.onBlock = function(block, callback) {
|
|||||||
|
|
||||||
operations = _.flattenDeep(operations);
|
operations = _.flattenDeep(operations);
|
||||||
|
|
||||||
setImmediate(function() {
|
callback(null, operations);
|
||||||
callback(null, operations);
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
AddressService.prototype._processInput = function(tx, input, index, opts) {
|
AddressService.prototype._processInput = function(tx, input, index, opts) {
|
||||||
|
|||||||
@ -73,13 +73,5 @@ Encoding.prototype.decodeMempoolAddressKey = function(buffer) {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Encoding.prototype.encodeMempoolAddressValue = function(transaction) {
|
|
||||||
return transaction.toRaw();
|
|
||||||
};
|
|
||||||
|
|
||||||
Encoding.prototype.decodeMempoolAddressValue = function(buffer) {
|
|
||||||
return tx.fromRaw(buffer);
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = Encoding;
|
module.exports = Encoding;
|
||||||
|
|
||||||
|
|||||||
@ -64,6 +64,12 @@ MempoolService.prototype._flushMempool = function(callback) {
|
|||||||
lte: self._encoding.encodeMempoolTransactionKey(new Array(65).join('f'))
|
lte: self._encoding.encodeMempoolTransactionKey(new Array(65).join('f'))
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var timer = setInterval(function() {
|
||||||
|
log.info('Mempool Service: removed: ' + totalCount + ' records during mempool flush.');
|
||||||
|
}, 5000);
|
||||||
|
|
||||||
|
timer.unref();
|
||||||
|
|
||||||
var stream = self._db.createReadStream(criteria);
|
var stream = self._db.createReadStream(criteria);
|
||||||
|
|
||||||
stream.on('data', function(data) {
|
stream.on('data', function(data) {
|
||||||
@ -72,10 +78,12 @@ MempoolService.prototype._flushMempool = function(callback) {
|
|||||||
type: 'del',
|
type: 'del',
|
||||||
key: data.key
|
key: data.key
|
||||||
});
|
});
|
||||||
|
totalCount += ops.length;
|
||||||
self._db.batch(ops);
|
self._db.batch(ops);
|
||||||
});
|
});
|
||||||
|
|
||||||
stream.on('end', function() {
|
stream.on('end', function() {
|
||||||
|
clearInterval(timer);
|
||||||
log.info('Mempool Service: completed flushing: ' + totalCount + ' tx mempool records.');
|
log.info('Mempool Service: completed flushing: ' + totalCount + ' tx mempool records.');
|
||||||
callback();
|
callback();
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user