src/mempool/mempool.js
function Mempool(options) {
  if (!(this instanceof Mempool))
    return new Mempool(options);

  AsyncObject.call(this);

  this.options = new MempoolOptions(options);

  this.network = this.options.network;
  this.logger = this.options.logger.context('mempool');
  this.workers = this.options.workers;
  this.chain = this.options.chain;
  this.fees = this.options.fees;

  this.locker = this.chain.locker;

  this.cache = new MempoolCache(this.options);

  this.size = 0;
  this.freeCount = 0;
  this.lastTime = 0;
  this.lastFlush = 0;
  this.tip = this.network.genesis.hash;

  this.waiting = new Map();
  this.orphans = new Map();
  this.map = new Map();
  this.spents = new Map();
  this.rejects = new RollingFilter(120000, 0.000001);

  this.coinIndex = new CoinIndex();
  this.txIndex = new TXIndex();
}
function Mempool(options) {
  if (!(this instanceof Mempool))
    return new Mempool(options);

  AsyncObject.call(this);

  this.options = new MempoolOptions(options);

  this.network = this.options.network;
  this.logger = this.options.logger.context('mempool');
  this.workers = this.options.workers;
  this.chain = this.options.chain;
  this.fees = this.options.fees;

  this.locker = this.chain.locker;

  this.cache = new MempoolCache(this.options);

  this.size = 0;
  this.freeCount = 0;
  this.lastTime = 0;
  this.lastFlush = 0;
  this.tip = this.network.genesis.hash;

  this.waiting = new Map();
  this.orphans = new Map();
  this.map = new Map();
  this.spents = new Map();
  this.rejects = new RollingFilter(120000, 0.000001);

  this.coinIndex = new CoinIndex();
  this.txIndex = new TXIndex();
}
function Mempool ( options ) { if ( ! ( this instanceof Mempool ) ) return new Mempool ( options ) ; AsyncObject . call ( this ) ; this . options = new MempoolOptions ( options ) ; this . network = this . options . network ; this . logger = this . options . logger . context ( 'mempool' ) ; this . workers = this . options . workers ; this . chain = this . options . chain ; this . fees = this . options . fees ; this . locker = this . chain . locker ; this . cache = new MempoolCache ( this . options ) ; this . size = 0 ; this . freeCount = 0 ; this . lastTime = 0 ; this . lastFlush = 0 ; this . tip = this . network . genesis . hash ; this . waiting = new Map ( ) ; this . orphans = new Map ( ) ; this . map = new Map ( ) ; this . spents = new Map ( ) ; this . rejects = new RollingFilter ( 120000 , 0.000001 ) ; this . coinIndex = new CoinIndex ( ) ; this . txIndex = new TXIndex ( ) ; }
Represents a mempool.
@alias module:mempool.Mempool
@constructor
@param {Object} options
@param {String?} options.name - Database name.
@param {String?} options.location - Database file location.
@param {String?} options.db - Database backend (`"memory"` by default).
@param {Boolean?} options.limitFree
@param {Number?} options.limitFreeRelay
@param {Number?} options.maxSize - Max pool size (default ~300mb).
@param {Boolean?} options.relayPriority
@param {Boolean?} options.requireStandard
@param {Boolean?} options.rejectAbsurdFees
@param {Boolean?} options.relay
@property {Boolean} loaded
@property {Object} db
@property {Number} size
@property {Lock} locker
@property {Number} freeCount
@property {Number} lastTime
@property {Number} maxSize
@property {Rate} minRelayFee
@emits Mempool#open
@emits Mempool#error
@emits Mempool#tx
@emits Mempool#add tx
@emits Mempool#remove tx
Represents a mempool .