Adding option mempoolOnly in querying
- mempoolOnly option make the query in db from mempool only (ie, unconfirmed tx only
This commit is contained in:
parent
27f3993884
commit
df7710ded1
@ -189,6 +189,10 @@ AddressService.prototype.getAddressHistory = function(addresses, options, stream
|
|||||||
options.queryMempool = true;
|
options.queryMempool = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_.isUndefined(options.mempoolOnly)) {
|
||||||
|
options.mempoolOnly = false;
|
||||||
|
}
|
||||||
|
|
||||||
var old_support = false;
|
var old_support = false;
|
||||||
//Quick support for `from` and `to` options (DEPRECATED! Not recommeded to use)
|
//Quick support for `from` and `to` options (DEPRECATED! Not recommeded to use)
|
||||||
if( !_.isUndefined(options.from) || !_.isUndefined(options.to)) {
|
if( !_.isUndefined(options.from) || !_.isUndefined(options.to)) {
|
||||||
@ -859,6 +863,10 @@ AddressService.prototype._streamAddressSummary = function(address, options, stre
|
|||||||
options.queryMempool = true;
|
options.queryMempool = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_.isUndefined(options.mempoolOnly)) {
|
||||||
|
options.mempoolOnly = false;
|
||||||
|
}
|
||||||
|
|
||||||
//declare the queue to process tx data
|
//declare the queue to process tx data
|
||||||
var tmpTxList = {}; //store processed txid temporarily to ignore duplication
|
var tmpTxList = {}; //store processed txid temporarily to ignore duplication
|
||||||
|
|
||||||
@ -950,6 +958,10 @@ AddressService.prototype._streamAddressSummary = function(address, options, stre
|
|||||||
// stream the rest of the confirmed txids out of the address index
|
// stream the rest of the confirmed txids out of the address index
|
||||||
function(next) {
|
function(next) {
|
||||||
|
|
||||||
|
if (options.mempoolOnly) { //Option to query from mempool only (ie, unconfirmed txs only)
|
||||||
|
return next();
|
||||||
|
}
|
||||||
|
|
||||||
var txIdTransformStream = new Transform({ objectMode: true });
|
var txIdTransformStream = new Transform({ objectMode: true });
|
||||||
|
|
||||||
txIdTransformStream._flush = function(cb) {
|
txIdTransformStream._flush = function(cb) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user