mempool locker hasPending.
This commit is contained in:
parent
5c61760fef
commit
4700990bcd
@ -71,7 +71,7 @@ function Mempool(options) {
|
||||
|
||||
this.loaded = false;
|
||||
|
||||
this.locker = new bcoin.locker(this, this.addTX, 20 << 20);
|
||||
this.locker = new bcoin.locker(this, this.addTX, 100 << 20);
|
||||
this.writeLock = new bcoin.locker(this);
|
||||
|
||||
this.db = null;
|
||||
@ -510,8 +510,12 @@ Mempool.prototype.hasTX = function hasTX(hash, callback) {
|
||||
* @param {Function} callback - Returns [Error, Boolean].
|
||||
*/
|
||||
|
||||
Mempool.prototype.hasAny = function hasAny(hash, callback) {
|
||||
Mempool.prototype.has = function has(hash, callback) {
|
||||
var self = this;
|
||||
|
||||
if (this.locker.hasPending(hash))
|
||||
return utils.asyncify(callback)(null, true);
|
||||
|
||||
return this.hasTX(hash, function(err, exists) {
|
||||
if (err)
|
||||
return callback(err);
|
||||
|
||||
@ -1642,7 +1642,7 @@ Pool.prototype.getData = function getData(peer, type, hash, options, callback) {
|
||||
if (type === this.tx.type) {
|
||||
if (!this.mempool)
|
||||
return utils.asyncify(done)(null, false);
|
||||
return this.mempool.hasAny(hash, done);
|
||||
return this.mempool.has(hash, done);
|
||||
}
|
||||
|
||||
return this.chain.has(hash, done);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user