src/mempool/fees.js
function PolicyEstimator(logger) {
  if (!(this instanceof PolicyEstimator))
    return new PolicyEstimator(logger);

  this.logger = Logger.global;

  this.minTrackedFee = MIN_FEERATE;
  this.minTrackedPri = MIN_PRIORITY;

  this.feeStats = new ConfirmStats('FeeRate');
  this.priStats = new ConfirmStats('Priority');

  this.feeUnlikely = 0;
  this.feeLikely = INF_FEERATE;
  this.priUnlikely = 0;
  this.priLikely = INF_PRIORITY;

  this.map = new Map();
  this.bestHeight = 0;

  if (policy.MIN_RELAY >= MIN_FEERATE)
    this.minTrackedFee = policy.MIN_RELAY;

  if (policy.FREE_THRESHOLD >= MIN_PRIORITY)
    this.minTrackedPri = policy.FREE_THRESHOLD;

  if (logger) {
    assert(typeof logger === 'object');
    this.logger = logger.context('fees');
    this.feeStats.logger = this.logger;
    this.priStats.logger = this.logger;
  }
}
function PolicyEstimator(logger) {
  if (!(this instanceof PolicyEstimator))
    return new PolicyEstimator(logger);

  this.logger = Logger.global;

  this.minTrackedFee = MIN_FEERATE;
  this.minTrackedPri = MIN_PRIORITY;

  this.feeStats = new ConfirmStats('FeeRate');
  this.priStats = new ConfirmStats('Priority');

  this.feeUnlikely = 0;
  this.feeLikely = INF_FEERATE;
  this.priUnlikely = 0;
  this.priLikely = INF_PRIORITY;

  this.map = new Map();
  this.bestHeight = 0;

  if (policy.MIN_RELAY >= MIN_FEERATE)
    this.minTrackedFee = policy.MIN_RELAY;

  if (policy.FREE_THRESHOLD >= MIN_PRIORITY)
    this.minTrackedPri = policy.FREE_THRESHOLD;

  if (logger) {
    assert(typeof logger === 'object');
    this.logger = logger.context('fees');
    this.feeStats.logger = this.logger;
    this.priStats.logger = this.logger;
  }
}
function PolicyEstimator ( logger ) { if ( ! ( this instanceof PolicyEstimator ) ) return new PolicyEstimator ( logger ) ; this . logger = Logger . global ; this . minTrackedFee = MIN_FEERATE ; this . minTrackedPri = MIN_PRIORITY ; this . feeStats = new ConfirmStats ( 'FeeRate' ) ; this . priStats = new ConfirmStats ( 'Priority' ) ; this . feeUnlikely = 0 ; this . feeLikely = INF_FEERATE ; this . priUnlikely = 0 ; this . priLikely = INF_PRIORITY ; this . map = new Map ( ) ; this . bestHeight = 0 ; if ( policy . MIN_RELAY >= MIN_FEERATE ) this . minTrackedFee = policy . MIN_RELAY ; if ( policy . FREE_THRESHOLD >= MIN_PRIORITY ) this . minTrackedPri = policy . FREE_THRESHOLD ; if ( logger ) { assert ( typeof logger === 'object' ) ; this . logger = logger . context ( 'fees' ) ; this . feeStats . logger = this . logger ; this . priStats . logger = this . logger ; } }
Estimator for fees and priority.
@alias module:mempool.PolicyEstimator
@constructor
@param {Logger?} logger
Estimator for fees and priority .