You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
966 lines
39 KiB
966 lines
39 KiB
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>JSDoc: Source: mempool/fees.js</title>
|
|
|
|
<script src="scripts/prettify/prettify.js"> </script>
|
|
<script src="scripts/prettify/lang-css.js"> </script>
|
|
<!--[if lt IE 9]>
|
|
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
|
<![endif]-->
|
|
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
|
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<div id="main">
|
|
|
|
<h1 class="page-title">Source: mempool/fees.js</h1>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<section>
|
|
<article>
|
|
<pre class="prettyprint source linenums"><code>/*!
|
|
* fees.js - fee estimation for bcoin
|
|
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
|
|
* https://github.com/bcoin-org/bcoin
|
|
* Ported from:
|
|
* https://github.com/bitcoin/bitcoin/blob/master/src/policy/fees.cpp
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
var assert = require('assert');
|
|
var util = require('../utils/util');
|
|
var consensus = require('../protocol/consensus');
|
|
var policy = require('../protocol/policy');
|
|
var BufferReader = require('../utils/reader');
|
|
var StaticWriter = require('../utils/staticwriter');
|
|
var encoding = require('../utils/encoding');
|
|
var Logger = require('../node/logger');
|
|
var Network = require('../protocol/network');
|
|
var global = util.global;
|
|
var Float64Array = global.Float64Array || Array;
|
|
var Int32Array = global.Int32Array || Array;
|
|
|
|
/*
|
|
* Constants
|
|
*/
|
|
|
|
var MAX_BLOCK_CONFIRMS = 25;
|
|
var DEFAULT_DECAY = 0.998;
|
|
var MIN_SUCCESS_PCT = 0.95;
|
|
var UNLIKELY_PCT = 0.5;
|
|
var SUFFICIENT_FEETXS = 1;
|
|
var SUFFICIENT_PRITXS = 0.2;
|
|
var MIN_FEERATE = 10;
|
|
var MAX_FEERATE = 1e7;
|
|
var INF_FEERATE = consensus.MAX_MONEY;
|
|
var MIN_PRIORITY = 10;
|
|
var MAX_PRIORITY = 1e16;
|
|
var INF_PRIORITY = 1e9 * consensus.MAX_MONEY;
|
|
var FEE_SPACING = 1.1;
|
|
var PRI_SPACING = 2;
|
|
var FREE_THRESHOLD = policy.FREE_THRESHOLD;
|
|
|
|
/**
|
|
* Confirmation stats.
|
|
* @alias module:mempool.ConfirmStats
|
|
* @constructor
|
|
* @param {String} type
|
|
* @param {Logger} logger
|
|
*/
|
|
|
|
function ConfirmStats(type, logger) {
|
|
if (!(this instanceof ConfirmStats))
|
|
return new ConfirmStats(type, logger);
|
|
|
|
this.logger = logger || Logger.global;
|
|
|
|
this.type = type;
|
|
this.decay = 0;
|
|
this.maxConfirms = 0;
|
|
|
|
this.buckets = new Float64Array(0);
|
|
this.bucketMap = new DoubleMap();
|
|
|
|
this.confAvg = [];
|
|
this.curBlockConf = [];
|
|
this.unconfTX = [];
|
|
|
|
this.oldUnconfTX = new Int32Array(0);
|
|
this.curBlockTX = new Int32Array(0);
|
|
this.txAvg = new Float64Array(0);
|
|
this.curBlockVal = new Float64Array(0);
|
|
this.avg = new Float64Array(0);
|
|
}
|
|
|
|
/**
|
|
* Initialize stats.
|
|
* @param {Array} buckets
|
|
* @param {Number} maxConfirms
|
|
* @param {Number} decay
|
|
* @private
|
|
*/
|
|
|
|
ConfirmStats.prototype.init = function init(buckets, maxConfirms, decay) {
|
|
var i;
|
|
|
|
this.maxConfirms = maxConfirms;
|
|
this.decay = decay;
|
|
|
|
this.buckets = new Float64Array(buckets.length);
|
|
this.bucketMap = new DoubleMap();
|
|
|
|
for (i = 0; i < buckets.length; i++) {
|
|
this.buckets[i] = buckets[i];
|
|
this.bucketMap.insert(buckets[i], i);
|
|
}
|
|
|
|
this.confAvg = new Array(maxConfirms);
|
|
this.curBlockConf = new Array(maxConfirms);
|
|
this.unconfTX = new Array(maxConfirms);
|
|
|
|
for (i = 0; i < maxConfirms; i++) {
|
|
this.confAvg[i] = new Float64Array(buckets.length);
|
|
this.curBlockConf[i] = new Int32Array(buckets.length);
|
|
this.unconfTX[i] = new Int32Array(buckets.length);
|
|
}
|
|
|
|
this.oldUnconfTX = new Int32Array(buckets.length);
|
|
this.curBlockTX = new Int32Array(buckets.length);
|
|
this.txAvg = new Float64Array(buckets.length);
|
|
this.curBlockVal = new Float64Array(buckets.length);
|
|
this.avg = new Float64Array(buckets.length);
|
|
};
|
|
|
|
/**
|
|
* Clear data for the current block.
|
|
* @param {Number} height
|
|
*/
|
|
|
|
ConfirmStats.prototype.clearCurrent = function clearCurrent(height) {
|
|
var i, j;
|
|
|
|
for (i = 0; i < this.buckets.length; i++) {
|
|
this.oldUnconfTX[i] = this.unconfTX[height % this.unconfTX.length][i];
|
|
this.unconfTX[height % this.unconfTX.length][i] = 0;
|
|
for (j = 0; j < this.curBlockConf.length; j++)
|
|
this.curBlockConf[j][i] = 0;
|
|
this.curBlockTX[i] = 0;
|
|
this.curBlockVal[i] = 0;
|
|
}
|
|
};
|
|
|
|
/**
|
|
* Record a rate or priority based on number of blocks to confirm.
|
|
* @param {Number} blocks - Blocks to confirm.
|
|
* @param {Rate|Number} val - Rate or priority.
|
|
*/
|
|
|
|
ConfirmStats.prototype.record = function record(blocks, val) {
|
|
var i, bucketIndex;
|
|
|
|
if (blocks < 1)
|
|
return;
|
|
|
|
bucketIndex = this.bucketMap.search(val);
|
|
|
|
for (i = blocks; i <= this.curBlockConf.length; i++)
|
|
this.curBlockConf[i - 1][bucketIndex]++;
|
|
|
|
this.curBlockTX[bucketIndex]++;
|
|
this.curBlockVal[bucketIndex] += val;
|
|
};
|
|
|
|
/**
|
|
* Update moving averages.
|
|
*/
|
|
|
|
ConfirmStats.prototype.updateAverages = function updateAverages() {
|
|
var i, j;
|
|
|
|
for (i = 0; i < this.buckets.length; i++) {
|
|
for (j = 0; j < this.confAvg.length; j++) {
|
|
this.confAvg[j][i] =
|
|
this.confAvg[j][i] * this.decay + this.curBlockConf[j][i];
|
|
}
|
|
this.avg[i] = this.avg[i] * this.decay + this.curBlockVal[i];
|
|
this.txAvg[i] = this.txAvg[i] * this.decay + this.curBlockTX[i];
|
|
}
|
|
};
|
|
|
|
/**
|
|
* Estimate the median value for rate or priority.
|
|
* @param {Number} target - Confirmation target.
|
|
* @param {Number} needed - Sufficient tx value.
|
|
* @param {Number} breakpoint - Success break point.
|
|
* @param {Boolean} greater - Whether to look for lowest value.
|
|
* @param {Number} height - Block height.
|
|
* @returns {Rate|Number} Returns -1 on error.
|
|
*/
|
|
|
|
ConfirmStats.prototype.estimateMedian = function estimateMedian(target, needed, breakpoint, greater, height) {
|
|
var conf = 0;
|
|
var total = 0;
|
|
var extra = 0;
|
|
var max = this.buckets.length - 1;
|
|
var start = greater ? max : 0;
|
|
var step = greater ? -1 : 1;
|
|
var near = start;
|
|
var far = start;
|
|
var bestNear = start;
|
|
var bestFar = start;
|
|
var found = false;
|
|
var bins = this.unconfTX.length;
|
|
var i, j, perc, median, sum, minBucket, maxBucket;
|
|
|
|
for (i = start; i >= 0 && i <= max; i += step) {
|
|
far = i;
|
|
conf += this.confAvg[target - 1][i];
|
|
total += this.txAvg[i];
|
|
|
|
for (j = target; j < this.maxConfirms; j++)
|
|
extra += this.unconfTX[Math.max(height - j, 0) % bins][i];
|
|
|
|
extra += this.oldUnconfTX[i];
|
|
|
|
if (total >= needed / (1 - this.decay)) {
|
|
perc = conf / (total + extra);
|
|
|
|
if (greater && perc < breakpoint)
|
|
break;
|
|
|
|
if (!greater && perc > breakpoint)
|
|
break;
|
|
|
|
found = true;
|
|
conf = 0;
|
|
total = 0;
|
|
extra = 0;
|
|
bestNear = near;
|
|
bestFar = far;
|
|
near = i + step;
|
|
}
|
|
}
|
|
|
|
median = -1;
|
|
sum = 0;
|
|
|
|
minBucket = bestNear < bestFar ? bestNear : bestFar;
|
|
maxBucket = bestNear > bestFar ? bestNear : bestFar;
|
|
|
|
for (i = minBucket; i <= maxBucket; i++)
|
|
sum += this.txAvg[i];
|
|
|
|
if (found && sum !== 0) {
|
|
sum = sum / 2;
|
|
for (j = minBucket; j <= maxBucket; j++) {
|
|
if (this.txAvg[j] < sum) {
|
|
sum -= this.txAvg[j];
|
|
} else {
|
|
median = this.avg[j] / this.txAvg[j];
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
return median;
|
|
};
|
|
|
|
/**
|
|
* Add a transaction's rate/priority to be tracked.
|
|
* @param {Number} height - Block height.
|
|
* @param {Number} val
|
|
* @returns {Number} Bucket index.
|
|
*/
|
|
|
|
ConfirmStats.prototype.addTX = function addTX(height, val) {
|
|
var bucketIndex = this.bucketMap.search(val);
|
|
var blockIndex = height % this.unconfTX.length;
|
|
this.unconfTX[blockIndex][bucketIndex]++;
|
|
this.logger.spam('estimatefee: Adding tx to %s.', this.type);
|
|
return bucketIndex;
|
|
};
|
|
|
|
/**
|
|
* Remove a transaction from tracking.
|
|
* @param {Number} entryHeight
|
|
* @param {Number} bestHeight
|
|
* @param {Number} bucketIndex
|
|
*/
|
|
|
|
ConfirmStats.prototype.removeTX = function removeTX(entryHeight, bestHeight, bucketIndex) {
|
|
var blocksAgo = bestHeight - entryHeight;
|
|
var blockIndex;
|
|
|
|
if (bestHeight === 0)
|
|
blocksAgo = 0;
|
|
|
|
if (blocksAgo < 0) {
|
|
this.logger.debug('estimatefee: Blocks ago is negative for mempool tx.');
|
|
return;
|
|
}
|
|
|
|
if (blocksAgo >= this.unconfTX.length) {
|
|
if (this.oldUnconfTX[bucketIndex] > 0) {
|
|
this.oldUnconfTX[bucketIndex]--;
|
|
} else {
|
|
this.logger.debug('estimatefee:'
|
|
+ ' Mempool tx removed >25 blocks (bucket=%d).',
|
|
bucketIndex);
|
|
}
|
|
} else {
|
|
blockIndex = entryHeight % this.unconfTX.length;
|
|
if (this.unconfTX[blockIndex][bucketIndex] > 0) {
|
|
this.unconfTX[blockIndex][bucketIndex]--;
|
|
} else {
|
|
this.logger.debug('estimatefee:'
|
|
+ ' Mempool tx removed (block=%d, bucket=%d).',
|
|
blockIndex, bucketIndex);
|
|
}
|
|
}
|
|
};
|
|
|
|
/**
|
|
* Get serialization size.
|
|
* @returns {Number}
|
|
*/
|
|
|
|
ConfirmStats.prototype.getSize = function getSize() {
|
|
var size = 0;
|
|
var i;
|
|
|
|
size += 8;
|
|
|
|
size += sizeArray(this.buckets);
|
|
size += sizeArray(this.avg);
|
|
size += sizeArray(this.txAvg);
|
|
|
|
size += encoding.sizeVarint(this.maxConfirms);
|
|
for (i = 0; i < this.maxConfirms; i++)
|
|
size += sizeArray(this.confAvg[i]);
|
|
|
|
return size;
|
|
};
|
|
|
|
/**
|
|
* Serialize confirm stats.
|
|
* @returns {Buffer}
|
|
*/
|
|
|
|
ConfirmStats.prototype.toRaw = function toRaw() {
|
|
var size = this.getSize();
|
|
var bw = new StaticWriter(size);
|
|
var i;
|
|
|
|
bw.writeDouble(this.decay);
|
|
writeArray(bw, this.buckets);
|
|
writeArray(bw, this.avg);
|
|
writeArray(bw, this.txAvg);
|
|
bw.writeVarint(this.maxConfirms);
|
|
|
|
for (i = 0; i < this.maxConfirms; i++)
|
|
writeArray(bw, this.confAvg[i]);
|
|
|
|
return bw.render();
|
|
};
|
|
|
|
/**
|
|
* Instantiate confirm stats from serialized data.
|
|
* @param {Buffer} data
|
|
* @param {String} type
|
|
* @returns {ConfirmStats}
|
|
*/
|
|
|
|
ConfirmStats.fromRaw = function fromRaw(data, type, logger) {
|
|
var br = new BufferReader(data);
|
|
var i, decay, buckets, avg, txAvg, maxConfirms, confAvg, stats;
|
|
|
|
decay = br.readDouble();
|
|
buckets = readArray(br);
|
|
avg = readArray(br);
|
|
txAvg = readArray(br);
|
|
maxConfirms = br.readVarint();
|
|
confAvg = new Array(maxConfirms);
|
|
|
|
for (i = 0; i < maxConfirms; i++)
|
|
confAvg[i] = readArray(br);
|
|
|
|
if (decay <= 0 || decay >= 1)
|
|
throw new Error('Decay must be between 0 and 1 (non-inclusive).');
|
|
|
|
if (buckets.length <= 1 || buckets.length > 1000)
|
|
throw new Error('Must have between 2 and 1000 fee/pri buckets.');
|
|
|
|
if (avg.length !== buckets.length)
|
|
throw new Error('Mismatch in fee/pri average bucket count.');
|
|
|
|
if (txAvg.length !== buckets.length)
|
|
throw new Error('Mismatch in tx count bucket count.');
|
|
|
|
if (maxConfirms <= 0 || maxConfirms > 6 * 24 * 7)
|
|
throw new Error('Must maintain estimates for between 1 and 1008 confirms.');
|
|
|
|
for (i = 0; i < maxConfirms; i++) {
|
|
if (confAvg[i].length !== buckets.length)
|
|
throw new Error('Mismatch in fee/pri conf average bucket count.');
|
|
}
|
|
|
|
stats = new ConfirmStats(type, logger);
|
|
|
|
stats.init(buckets, maxConfirms, decay);
|
|
|
|
stats.avg = avg;
|
|
stats.txAvg = txAvg;
|
|
stats.confAvg = confAvg;
|
|
|
|
return stats;
|
|
};
|
|
|
|
/**
|
|
* Estimator for fees and priority.
|
|
* @alias module:mempool.PolicyEstimator
|
|
* @constructor
|
|
* @param {Rate} minRelay
|
|
* @param {Network|NetworkType} network
|
|
*/
|
|
|
|
function PolicyEstimator(minRelay, network, logger) {
|
|
if (!(this instanceof PolicyEstimator))
|
|
return new PolicyEstimator(minRelay, network, logger);
|
|
|
|
this.network = Network.get(network);
|
|
this.logger = logger || Logger.global;
|
|
|
|
this.minTrackedFee = minRelay < MIN_FEERATE
|
|
? MIN_FEERATE
|
|
: minRelay;
|
|
|
|
this.minTrackedPri = FREE_THRESHOLD < MIN_PRIORITY
|
|
? MIN_PRIORITY
|
|
: FREE_THRESHOLD;
|
|
|
|
this.feeStats = new ConfirmStats('FeeRate', this.logger);
|
|
this.priStats = new ConfirmStats('Priority', this.logger);
|
|
|
|
this.feeUnlikely = 0;
|
|
this.feeLikely = INF_FEERATE;
|
|
this.priUnlikely = 0;
|
|
this.priLikely = INF_PRIORITY;
|
|
|
|
this.map = {};
|
|
this.mapSize = 0;
|
|
this.bestHeight = 0;
|
|
|
|
this.init();
|
|
}
|
|
|
|
/**
|
|
* Initialize the estimator.
|
|
* @private
|
|
*/
|
|
|
|
PolicyEstimator.prototype.init = function init() {
|
|
var fee = [];
|
|
var priority = [];
|
|
var boundary;
|
|
|
|
for (boundary = this.minTrackedFee;
|
|
boundary <= MAX_FEERATE;
|
|
boundary *= FEE_SPACING) {
|
|
fee.push(boundary);
|
|
}
|
|
|
|
fee.push(INF_FEERATE);
|
|
|
|
for (boundary = this.minTrackedPri;
|
|
boundary <= MAX_PRIORITY;
|
|
boundary *= PRI_SPACING) {
|
|
priority.push(boundary);
|
|
}
|
|
|
|
priority.push(INF_PRIORITY);
|
|
|
|
this.feeStats.init(fee, MAX_BLOCK_CONFIRMS, DEFAULT_DECAY);
|
|
this.priStats.init(priority, MAX_BLOCK_CONFIRMS, DEFAULT_DECAY);
|
|
};
|
|
|
|
/**
|
|
* Reset the estimator.
|
|
*/
|
|
|
|
PolicyEstimator.prototype.reset = function reset() {
|
|
this.feeUnlikely = 0;
|
|
this.feeLikely = INF_FEERATE;
|
|
this.priUnlikely = 0;
|
|
this.priLikely = INF_PRIORITY;
|
|
|
|
this.map = {};
|
|
this.mapSize = 0;
|
|
this.bestHeight = 0;
|
|
|
|
this.init();
|
|
};
|
|
|
|
/**
|
|
* Stop tracking a tx. Remove from map.
|
|
* @param {Hash} hash
|
|
*/
|
|
|
|
PolicyEstimator.prototype.removeTX = function removeTX(hash) {
|
|
var item = this.map[hash];
|
|
|
|
if (!item) {
|
|
this.logger.spam(
|
|
'estimatefee: Mempool tx %s not found.',
|
|
util.revHex(hash));
|
|
return;
|
|
}
|
|
|
|
this.feeStats.removeTX(item.blockHeight, this.bestHeight, item.bucketIndex);
|
|
|
|
delete this.map[hash];
|
|
this.mapSize--;
|
|
};
|
|
|
|
/**
|
|
* Test whether a fee should be used for calculation.
|
|
* @param {Amount} fee
|
|
* @param {Number} priority
|
|
* @returns {Boolean}
|
|
*/
|
|
|
|
PolicyEstimator.prototype.isFeePoint = function isFeePoint(fee, priority) {
|
|
if ((priority < this.minTrackedPri && fee >= this.minTrackedFee)
|
|
|| (priority < this.priUnlikely && fee > this.feeLikely)) {
|
|
return true;
|
|
}
|
|
return false;
|
|
};
|
|
|
|
/**
|
|
* Test whether a priority should be used for calculation.
|
|
* @param {Amount} fee
|
|
* @param {Number} priority
|
|
* @returns {Boolean}
|
|
*/
|
|
|
|
PolicyEstimator.prototype.isPriPoint = function isPriPoint(fee, priority) {
|
|
if ((fee < this.minTrackedFee && priority >= this.minTrackedPri)
|
|
|| (fee < this.feeUnlikely && priority > this.priLikely)) {
|
|
return true;
|
|
}
|
|
return false;
|
|
};
|
|
|
|
/**
|
|
* Process a mempool entry.
|
|
* @param {MempoolEntry} entry
|
|
* @param {Boolean} current - Whether the chain is synced.
|
|
*/
|
|
|
|
PolicyEstimator.prototype.processTX = function processTX(entry, current) {
|
|
var height = entry.height;
|
|
var hash = entry.tx.hash('hex');
|
|
var fee, rate, priority, item;
|
|
|
|
if (this.map[hash]) {
|
|
this.logger.debug(
|
|
'estimatefee: Mempool tx %s already tracked.',
|
|
entry.tx.txid());
|
|
return;
|
|
}
|
|
|
|
// Ignore reorgs.
|
|
if (height < this.bestHeight)
|
|
return;
|
|
|
|
// Wait for chain to sync.
|
|
if (!current)
|
|
return;
|
|
|
|
// Requires other mempool txs in order to be confirmed. Ignore.
|
|
if (entry.dependencies)
|
|
return;
|
|
|
|
fee = entry.getFee();
|
|
rate = entry.getRate();
|
|
priority = entry.getPriority(height);
|
|
|
|
this.logger.spam('estimatefee: Processing mempool tx %s.', entry.tx.txid());
|
|
|
|
if (fee === 0 || this.isPriPoint(rate, priority)) {
|
|
item = new StatEntry();
|
|
item.blockHeight = height;
|
|
item.bucketIndex = this.priStats.addTX(height, priority);
|
|
} else if (this.isFeePoint(rate, priority)) {
|
|
item = new StatEntry();
|
|
item.blockHeight = height;
|
|
item.bucketIndex = this.feeStats.addTX(height, rate);
|
|
}
|
|
|
|
if (!item) {
|
|
this.logger.spam('estimatefee: Not adding tx %s.', entry.tx.txid());
|
|
return;
|
|
}
|
|
|
|
this.map[hash] = item;
|
|
this.mapSize++;
|
|
};
|
|
|
|
/**
|
|
* Process an entry being removed from the mempool.
|
|
* @param {Number} height - Block height.
|
|
* @param {MempoolEntry} entry
|
|
*/
|
|
|
|
PolicyEstimator.prototype.processBlockTX = function processBlockTX(height, entry) {
|
|
var blocks, fee, rate, priority;
|
|
|
|
// Requires other mempool txs in order to be confirmed. Ignore.
|
|
if (entry.dependencies)
|
|
return;
|
|
|
|
blocks = height - entry.height;
|
|
if (blocks <= 0) {
|
|
this.logger.debug(
|
|
'estimatefee: Block tx %s had negative blocks to confirm (%d, %d).',
|
|
entry.tx.txid(),
|
|
height,
|
|
entry.height);
|
|
return;
|
|
}
|
|
|
|
fee = entry.getFee();
|
|
rate = entry.getRate();
|
|
priority = entry.getPriority(height);
|
|
|
|
if (fee === 0 || this.isPriPoint(rate, priority))
|
|
this.priStats.record(blocks, priority);
|
|
else if (this.isFeePoint(rate, priority))
|
|
this.feeStats.record(blocks, rate);
|
|
};
|
|
|
|
/**
|
|
* Process a block of transaction entries being removed from the mempool.
|
|
* @param {Number} height - Block height.
|
|
* @param {MempoolEntry[]} entries
|
|
* @param {Boolean} current - Whether the chain is synced.
|
|
*/
|
|
|
|
PolicyEstimator.prototype.processBlock = function processBlock(height, entries, current) {
|
|
var i;
|
|
|
|
// Ignore reorgs.
|
|
if (height <= this.bestHeight)
|
|
return;
|
|
|
|
this.bestHeight = height;
|
|
|
|
if (entries.length === 0)
|
|
return;
|
|
|
|
// Wait for chain to sync.
|
|
if (!current)
|
|
return;
|
|
|
|
this.logger.debug('estimatefee: Recalculating dynamic cutoffs.');
|
|
|
|
this.feeLikely = this.feeStats.estimateMedian(
|
|
2, SUFFICIENT_FEETXS, MIN_SUCCESS_PCT,
|
|
true, height);
|
|
|
|
if (this.feeLikely === -1)
|
|
this.feeLikely = INF_FEERATE;
|
|
|
|
this.feeUnlikely = this.feeStats.estimateMedian(
|
|
10, SUFFICIENT_FEETXS, UNLIKELY_PCT,
|
|
false, height);
|
|
|
|
if (this.feeUnlikely === -1)
|
|
this.feeUnlikely = 0;
|
|
|
|
this.priLikely = this.priStats.estimateMedian(
|
|
2, SUFFICIENT_PRITXS, MIN_SUCCESS_PCT,
|
|
true, height);
|
|
|
|
if (this.priLikely === -1)
|
|
this.priLikely = INF_PRIORITY;
|
|
|
|
this.priUnlikely = this.priStats.estimateMedian(
|
|
10, SUFFICIENT_PRITXS, UNLIKELY_PCT,
|
|
false, height);
|
|
|
|
if (this.priUnlikely === -1)
|
|
this.priUnlikely = 0;
|
|
|
|
this.feeStats.clearCurrent(height);
|
|
this.priStats.clearCurrent(height);
|
|
|
|
for (i = 0; i < entries.length; i++)
|
|
this.processBlockTX(height, entries[i]);
|
|
|
|
this.feeStats.updateAverages();
|
|
this.priStats.updateAverages();
|
|
|
|
this.logger.debug('estimatefee: Done updating estimates'
|
|
+ ' for %d confirmed entries. New mempool map size %d.',
|
|
entries.length, this.mapSize);
|
|
|
|
this.logger.debug('estimatefee: Rate: %d.', this.estimateFee());
|
|
};
|
|
|
|
/**
|
|
* Estimate a fee rate.
|
|
* @param {Number} [target=1] - Confirmation target.
|
|
* @param {Boolean} [smart=true] - Smart estimation.
|
|
* @returns {Rate}
|
|
*/
|
|
|
|
PolicyEstimator.prototype.estimateFee = function estimateFee(target, smart) {
|
|
var rate;
|
|
|
|
if (!target)
|
|
target = 1;
|
|
|
|
if (smart == null)
|
|
smart = true;
|
|
|
|
assert(util.isUInt32(target), 'Target must be a number.');
|
|
assert(target <= this.feeStats.maxConfirms,
|
|
'Too many confirmations for estimate.');
|
|
|
|
if (!smart) {
|
|
rate = this.feeStats.estimateMedian(
|
|
target, SUFFICIENT_FEETXS, MIN_SUCCESS_PCT,
|
|
true, this.bestHeight);
|
|
|
|
if (rate < 0)
|
|
return 0;
|
|
|
|
return Math.floor(rate);
|
|
}
|
|
|
|
rate = -1;
|
|
while (rate < 0 && target <= this.feeStats.maxConfirms) {
|
|
rate = this.feeStats.estimateMedian(
|
|
target++, SUFFICIENT_FEETXS, MIN_SUCCESS_PCT,
|
|
true, this.bestHeight);
|
|
}
|
|
|
|
target -= 1;
|
|
|
|
if (rate < this.network.feeRate)
|
|
return this.network.feeRate;
|
|
|
|
if (rate > this.network.maxFeeRate)
|
|
return this.network.maxFeeRate;
|
|
|
|
if (rate < 0)
|
|
return 0;
|
|
|
|
return Math.floor(rate);
|
|
};
|
|
|
|
/**
|
|
* Estimate a priority.
|
|
* @param {Number} [target=1] - Confirmation target.
|
|
* @param {Boolean} [smart=true] - Smart estimation.
|
|
* @returns {Number}
|
|
*/
|
|
|
|
PolicyEstimator.prototype.estimatePriority = function estimatePriority(target, smart) {
|
|
var priority;
|
|
|
|
if (!target)
|
|
target = 1;
|
|
|
|
if (smart == null)
|
|
smart = true;
|
|
|
|
assert(util.isUInt32(target), 'Target must be a number.');
|
|
assert(target <= this.priStats.maxConfirms,
|
|
'Too many confirmations for estimate.');
|
|
|
|
if (!smart) {
|
|
priority = this.priStats.estimateMedian(
|
|
target, SUFFICIENT_PRITXS, MIN_SUCCESS_PCT,
|
|
true, this.bestHeight);
|
|
return Math.floor(priority);
|
|
}
|
|
|
|
// TODO: Add check for mempool limiting txs.
|
|
// Should return INF_PRIORITY.
|
|
|
|
priority = -1;
|
|
while (priority < 0 && target <= this.priStats.maxConfirms) {
|
|
priority = this.priStats.estimateMedian(
|
|
target++, SUFFICIENT_PRITXS, MIN_SUCCESS_PCT,
|
|
true, this.bestHeight);
|
|
}
|
|
|
|
target -= 1;
|
|
|
|
if (priority < 0)
|
|
return 0;
|
|
|
|
return Math.floor(priority);
|
|
};
|
|
|
|
/**
|
|
* Get serialization size.
|
|
* @returns {Number}
|
|
*/
|
|
|
|
PolicyEstimator.prototype.getSize = function getSize() {
|
|
var size = 0;
|
|
size += 8;
|
|
size += encoding.sizeVarlen(this.feeStats.getSize());
|
|
size += encoding.sizeVarlen(this.priStats.getSize());
|
|
return size;
|
|
};
|
|
|
|
/**
|
|
* Serialize the estimator.
|
|
* @returns {Buffer}
|
|
*/
|
|
|
|
PolicyEstimator.prototype.toRaw = function toRaw() {
|
|
var size = this.getSize();
|
|
var bw = new StaticWriter(size);
|
|
|
|
bw.writeU32(this.network.magic);
|
|
bw.writeU32(this.bestHeight);
|
|
bw.writeVarBytes(this.feeStats.toRaw());
|
|
bw.writeVarBytes(this.priStats.toRaw());
|
|
|
|
return bw.render();
|
|
};
|
|
|
|
/**
|
|
* Instantiate a policy estimator from serialized data.
|
|
* @param {Buffer} data
|
|
* @param {Rate} minRelay
|
|
* @param {Network|NetworkType} network
|
|
* @returns {PolicyEstimator}
|
|
*/
|
|
|
|
PolicyEstimator.fromRaw = function fromRaw(data, minRelay, logger) {
|
|
var br = new BufferReader(data);
|
|
var network = Network.fromMagic(br.readU32());
|
|
var bestHeight = br.readU32();
|
|
var estimator = new PolicyEstimator(minRelay, network, logger);
|
|
var feeStats = ConfirmStats.fromRaw(br.readVarBytes(), 'FeeRate', logger);
|
|
var priStats = ConfirmStats.fromRaw(br.readVarBytes(), 'Priority', logger);
|
|
|
|
estimator.bestHeight = bestHeight;
|
|
estimator.feeStats = feeStats;
|
|
estimator.priStats = priStats;
|
|
|
|
return estimator;
|
|
};
|
|
|
|
/**
|
|
* StatEntry
|
|
* @private
|
|
*/
|
|
|
|
function StatEntry() {
|
|
this.blockHeight = -1;
|
|
this.bucketIndex = -1;
|
|
}
|
|
|
|
/**
|
|
* DoubleMap
|
|
* @private
|
|
*/
|
|
|
|
function DoubleMap() {
|
|
if (!(this instanceof DoubleMap))
|
|
return new DoubleMap();
|
|
|
|
this.buckets = [];
|
|
}
|
|
|
|
DoubleMap.prototype.insert = function insert(key, value) {
|
|
var i = util.binarySearch(this.buckets, key, compare, true);
|
|
this.buckets.splice(i, 0, [key, value]);
|
|
};
|
|
|
|
DoubleMap.prototype.search = function search(key) {
|
|
var i = util.binarySearch(this.buckets, key, compare, true);
|
|
assert(this.buckets.length !== 0, 'Cannot search.');
|
|
return this.buckets[i][1];
|
|
};
|
|
|
|
/*
|
|
* Helpers
|
|
*/
|
|
|
|
function compare(a, b) {
|
|
return a[0] - b;
|
|
}
|
|
|
|
function sizeArray(buckets) {
|
|
var size = encoding.sizeVarint(buckets.length);
|
|
return size + buckets.length * 8;
|
|
}
|
|
|
|
function writeArray(bw, buckets) {
|
|
var i;
|
|
|
|
bw.writeVarint(buckets.length);
|
|
|
|
for (i = 0; i < buckets.length; i++)
|
|
bw.writeDouble(buckets[i]);
|
|
}
|
|
|
|
function readArray(br) {
|
|
var buckets = new Float64Array(br.readVarint());
|
|
var i;
|
|
|
|
for (i = 0; i < buckets.length; i++)
|
|
buckets[i] = br.readDouble();
|
|
|
|
return buckets;
|
|
}
|
|
|
|
/*
|
|
* Expose
|
|
*/
|
|
|
|
exports = PolicyEstimator;
|
|
exports.PolicyEstimator = PolicyEstimator;
|
|
exports.ConfirmStats = ConfirmStats;
|
|
|
|
module.exports = exports;
|
|
</code></pre>
|
|
</article>
|
|
</section>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<nav>
|
|
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bcoin.html">bcoin</a></li><li><a href="module-bip70.html">bip70</a></li><li><a href="module-bip70_pk.html">bip70/pk</a></li><li><a href="module-bip70_x509.html">bip70/x509</a></li><li><a href="module-blockchain.html">blockchain</a></li><li><a href="module-blockchain_common.html">blockchain/common</a></li><li><a href="module-btc.html">btc</a></li><li><a href="module-coins.html">coins</a></li><li><a href="module-crypto.html">crypto</a></li><li><a href="module-crypto_chachapoly.html">crypto/chachapoly</a></li><li><a href="module-crypto_ec.html">crypto/ec</a></li><li><a href="module-crypto_pk.html">crypto/pk</a></li><li><a href="module-crypto_schnorr.html">crypto/schnorr</a></li><li><a href="module-crypto_siphash.html">crypto/siphash</a></li><li><a href="module-db.html">db</a></li><li><a href="module-hd.html">hd</a></li><li><a href="module-http.html">http</a></li><li><a href="module-mempool.html">mempool</a></li><li><a href="module-mining.html">mining</a></li><li><a href="module-net.html">net</a></li><li><a href="module-net_bip152.html">net/bip152</a></li><li><a href="module-net_common.html">net/common</a></li><li><a href="module-net_dns.html">net/dns</a></li><li><a href="module-net_packets.html">net/packets</a></li><li><a href="module-net_socks.html">net/socks</a></li><li><a href="module-net_tcp.html">net/tcp</a></li><li><a href="module-node.html">node</a></li><li><a href="module-node_config.html">node/config</a></li><li><a href="module-primitives.html">primitives</a></li><li><a href="module-protocol.html">protocol</a></li><li><a href="module-protocol_consensus.html">protocol/consensus</a></li><li><a href="module-protocol_errors.html">protocol/errors</a></li><li><a href="module-protocol_networks.html">protocol/networks</a></li><li><a href="module-protocol_policy.html">protocol/policy</a></li><li><a href="module-script.html">script</a></li><li><a href="module-script_common.html">script/common</a></li><li><a href="module-utils.html">utils</a></li><li><a href="module-utils_asn1.html">utils/asn1</a></li><li><a href="module-utils_base32.html">utils/base32</a></li><li><a href="module-utils_base58.html">utils/base58</a></li><li><a href="module-utils_co.html">utils/co</a></li><li><a href="module-utils_encoding.html">utils/encoding</a></li><li><a href="module-utils_ip.html">utils/ip</a></li><li><a href="module-utils_pem.html">utils/pem</a></li><li><a href="module-utils_protobuf.html">utils/protobuf</a></li><li><a href="module-utils_util.html">utils/util</a></li><li><a href="module-wallet.html">wallet</a></li><li><a href="module-wallet_common.html">wallet/common</a></li><li><a href="module-wallet_records.html">wallet/records</a></li><li><a href="module-workers.html">workers</a></li><li><a href="module-workers_jobs.html">workers/jobs</a></li><li><a href="module-workers_packets.html">workers/packets</a></li></ul><h3>Classes</h3><ul><li><a href="Environment.html">Environment</a></li><li><a href="module-bip70.Payment.html">Payment</a></li><li><a href="module-bip70.PaymentACK.html">PaymentACK</a></li><li><a href="module-bip70.PaymentDetails.html">PaymentDetails</a></li><li><a href="module-bip70.PaymentRequest.html">PaymentRequest</a></li><li><a href="module-blockchain.Chain.html">Chain</a></li><li><a href="module-blockchain.ChainDB.html">ChainDB</a></li><li><a href="module-blockchain.ChainEntry.html">ChainEntry</a></li><li><a href="module-blockchain.ChainFlags.html">ChainFlags</a></li><li><a href="module-blockchain.ChainOptions.html">ChainOptions</a></li><li><a href="module-blockchain.ChainState.html">ChainState</a></li><li><a href="module-blockchain.DeploymentState.html">DeploymentState</a></li><li><a href="module-blockchain.StateCache.html">StateCache</a></li><li><a href="module-btc.Amount.html">Amount</a></li><li><a href="module-btc.URI.html">URI</a></li><li><a href="module-coins.CoinEntry.html">CoinEntry</a></li><li><a href="module-coins.Coins.html">Coins</a></li><li><a href="module-coins.CoinView.html">CoinView</a></li><li><a href="module-coins.UndoCoin.html">UndoCoin</a></li><li><a href="module-coins.UndoCoins.html">UndoCoins</a></li><li><a href="module-crypto_aes.AESCipher.html">AESCipher</a></li><li><a href="module-crypto_aes.AESDecipher.html">AESDecipher</a></li><li><a href="module-crypto_aes.AESKey.html">AESKey</a></li><li><a href="module-crypto_chachapoly.AEAD.html">AEAD</a></li><li><a href="module-crypto_chachapoly.ChaCha20.html">ChaCha20</a></li><li><a href="module-crypto_chachapoly.Poly1305.html">Poly1305</a></li><li><a href="module-crypto_sha256.SHA256.html">SHA256</a></li><li><a href="module-crypto_sha256.SHA256Hmac.html">SHA256Hmac</a></li><li><a href="module-db.LowlevelUp.html">LowlevelUp</a></li><li><a href="module-db.RBT.html">RBT</a></li><li><a href="module-hd.Mnemonic.html">Mnemonic</a></li><li><a href="module-hd.PrivateKey.html">PrivateKey</a></li><li><a href="module-hd.PublicKey.html">PublicKey</a></li><li><a href="module-http.Base.html">Base</a></li><li><a href="module-http.Client.html">Client</a></li><li><a href="module-http.HTTPBaseOptions.html">HTTPBaseOptions</a></li><li><a href="module-http.HTTPOptions.html">HTTPOptions</a></li><li><a href="module-http.Request.html">Request</a></li><li><a href="module-http.RPC.html">RPC</a></li><li><a href="module-http.RPCClient.html">RPCClient</a></li><li><a href="module-http.Server.html">Server</a></li><li><a href="module-http.Wallet.html">Wallet</a></li><li><a href="module-mempool.ConfirmStats.html">ConfirmStats</a></li><li><a href="module-mempool.Mempool.html">Mempool</a></li><li><a href="module-mempool.MempoolEntry.html">MempoolEntry</a></li><li><a href="module-mempool.MempoolOptions.html">MempoolOptions</a></li><li><a href="module-mempool.PolicyEstimator.html">PolicyEstimator</a></li><li><a href="module-mining.BlockEntry.html">BlockEntry</a></li><li><a href="module-mining.Miner.html">Miner</a></li><li><a href="module-mining.MinerBlock.html">MinerBlock</a></li><li><a href="module-mining.MinerOptions.html">MinerOptions</a></li><li><a href="module-net.AuthDB.html">AuthDB</a></li><li><a href="module-net.BIP150.html">BIP150</a></li><li><a href="module-net.BIP151.html">BIP151</a></li><li><a href="module-net.BIP151Stream.html">BIP151Stream</a></li><li><a href="module-net.BroadcastItem.html">BroadcastItem</a></li><li><a href="module-net.Framer.html">Framer</a></li><li><a href="module-net.HostEntry.html">HostEntry</a></li><li><a href="module-net.HostList.html">HostList</a></li><li><a href="module-net.Parser.html">Parser</a></li><li><a href="module-net.Peer.html">Peer</a></li><li><a href="module-net.PeerList.html">PeerList</a></li><li><a href="module-net.PeerOptions.html">PeerOptions</a></li><li><a href="module-net.Pool.html">Pool</a></li><li><a href="module-net.PoolOptions.html">PoolOptions</a></li><li><a href="module-net_bip152-CompactBlock.html">CompactBlock</a></li><li><a href="module-net_bip152-PrefilledTX.html">PrefilledTX</a></li><li><a href="module-net_bip152-TXRequest.html">TXRequest</a></li><li><a href="module-net_bip152-TXResponse.html">TXResponse</a></li><li><a href="module-net_packets-AddrPacket.html">AddrPacket</a></li><li><a href="module-net_packets-AuthChallengePacket.html">AuthChallengePacket</a></li><li><a href="module-net_packets-AuthProposePacket.html">AuthProposePacket</a></li><li><a href="module-net_packets-AuthReplyPacket.html">AuthReplyPacket</a></li><li><a href="module-net_packets-BlockPacket.html">BlockPacket</a></li><li><a href="module-net_packets-BlockTxnPacket.html">BlockTxnPacket</a></li><li><a href="module-net_packets-CmpctBlockPacket.html">CmpctBlockPacket</a></li><li><a href="module-net_packets-EncackPacket.html">EncackPacket</a></li><li><a href="module-net_packets-EncinitPacket.html">EncinitPacket</a></li><li><a href="module-net_packets-FeeFilterPacket.html">FeeFilterPacket</a></li><li><a href="module-net_packets-FilterAddPacket.html">FilterAddPacket</a></li><li><a href="module-net_packets-FilterClearPacket.html">FilterClearPacket</a></li><li><a href="module-net_packets-FilterLoadPacket.html">FilterLoadPacket</a></li><li><a href="module-net_packets-GetAddrPacket.html">GetAddrPacket</a></li><li><a href="module-net_packets-GetBlocksPacket.html">GetBlocksPacket</a></li><li><a href="module-net_packets-GetBlockTxnPacket.html">GetBlockTxnPacket</a></li><li><a href="module-net_packets-GetDataPacket.html">GetDataPacket</a></li><li><a href="module-net_packets-GetHeadersPacket.html">GetHeadersPacket</a></li><li><a href="module-net_packets-HeadersPacket.html">HeadersPacket</a></li><li><a href="module-net_packets-InvPacket.html">InvPacket</a></li><li><a href="module-net_packets-MempoolPacket.html">MempoolPacket</a></li><li><a href="module-net_packets-MerkleBlockPacket.html">MerkleBlockPacket</a></li><li><a href="module-net_packets-NotFoundPacket.html">NotFoundPacket</a></li><li><a href="module-net_packets-Packet.html">Packet</a></li><li><a href="module-net_packets-PingPacket.html">PingPacket</a></li><li><a href="module-net_packets-PongPacket.html">PongPacket</a></li><li><a href="module-net_packets-RejectPacket.html">RejectPacket</a></li><li><a href="module-net_packets-SendCmpctPacket.html">SendCmpctPacket</a></li><li><a href="module-net_packets-SendHeadersPacket.html">SendHeadersPacket</a></li><li><a href="module-net_packets-TXPacket.html">TXPacket</a></li><li><a href="module-net_packets-UnknownPacket.html">UnknownPacket</a></li><li><a href="module-net_packets-VerackPacket.html">VerackPacket</a></li><li><a href="module-net_packets-VersionPacket.html">VersionPacket</a></li><li><a href="module-net_socks-Proxy.html">Proxy</a></li><li><a href="module-net_socks-SOCKS.html">SOCKS</a></li><li><a href="module-node.FullNode.html">FullNode</a></li><li><a href="module-node.Logger.html">Logger</a></li><li><a href="module-node.Node.html">Node</a></li><li><a href="module-node.NodeClient.html">NodeClient</a></li><li><a href="module-node.SPVNode.html">SPVNode</a></li><li><a href="module-primitives.AbstractBlock.html">AbstractBlock</a></li><li><a href="module-primitives.Address.html">Address</a></li><li><a href="module-primitives.Block.html">Block</a></li><li><a href="module-primitives.Coin.html">Coin</a></li><li><a href="module-primitives.CoinSelector.html">CoinSelector</a></li><li><a href="module-primitives.Headers.html">Headers</a></li><li><a href="module-primitives.Input.html">Input</a></li><li><a href="module-primitives.InvItem.html">InvItem</a></li><li><a href="module-primitives.KeyRing.html">KeyRing</a></li><li><a href="module-primitives.MemBlock.html">MemBlock</a></li><li><a href="module-primitives.MerkleBlock.html">MerkleBlock</a></li><li><a href="module-primitives.MTX.html">MTX</a></li><li><a href="module-primitives.NetAddress.html">NetAddress</a></li><li><a href="module-primitives.Outpoint.html">Outpoint</a></li><li><a href="module-primitives.Output.html">Output</a></li><li><a href="module-primitives.TX.html">TX</a></li><li><a href="module-primitives.TXMeta.html">TXMeta</a></li><li><a href="module-protocol.Network.html">Network</a></li><li><a href="module-protocol.TimeData.html">TimeData</a></li><li><a href="module-protocol_errors-VerifyError.html">VerifyError</a></li><li><a href="module-protocol_errors-VerifyResult.html">VerifyResult</a></li><li><a href="module-script.Opcode.html">Opcode</a></li><li><a href="module-script.Program.html">Program</a></li><li><a href="module-script.Script.html">Script</a></li><li><a href="module-script.ScriptError.html">ScriptError</a></li><li><a href="module-script.SigCache.html">SigCache</a></li><li><a href="module-script.Stack.html">Stack</a></li><li><a href="module-script.Witness.html">Witness</a></li><li><a href="module-utils.AsyncEmitter.html">AsyncEmitter</a></li><li><a href="module-utils.AsyncObject.html">AsyncObject</a></li><li><a href="module-utils.Bloom.html">Bloom</a></li><li><a href="module-utils.BufferReader.html">BufferReader</a></li><li><a href="module-utils.BufferWriter.html">BufferWriter</a></li><li><a href="module-utils.List.html">List</a></li><li><a href="module-utils.ListItem.html">ListItem</a></li><li><a href="module-utils.Lock.html">Lock</a></li><li><a href="module-utils.LRU.html">LRU</a></li><li><a href="module-utils.LRUBatch.html">LRUBatch</a></li><li><a href="module-utils.LRUItem.html">LRUItem</a></li><li><a href="module-utils.LRUOp.html">LRUOp</a></li><li><a href="module-utils.Map.html">Map</a></li><li><a href="module-utils.MappedLock.html">MappedLock</a></li><li><a href="module-utils.RollingFilter.html">RollingFilter</a></li><li><a href="module-utils.StaticWriter.html">StaticWriter</a></li><li><a href="module-utils_ip.Address.html">Address</a></li><li><a href="module-utils_protobuf-ProtoReader.html">ProtoReader</a></li><li><a href="module-utils_protobuf-ProtoWriter.html">ProtoWriter</a></li><li><a href="module-wallet.Account.html">Account</a></li><li><a href="module-wallet.Balance.html">Balance</a></li><li><a href="module-wallet.BlockRecord.html">BlockRecord</a></li><li><a href="module-wallet.ChainState.html">ChainState</a></li><li><a href="module-wallet.Credit.html">Credit</a></li><li><a href="module-wallet.Details.html">Details</a></li><li><a href="module-wallet.DetailsMember.html">DetailsMember</a></li><li><a href="module-wallet.MasterKey.html">MasterKey</a></li><li><a href="module-wallet.Path.html">Path</a></li><li><a href="module-wallet.TXDB.html">TXDB</a></li><li><a href="module-wallet.Wallet.html">Wallet</a></li><li><a href="module-wallet.WalletClient.html">WalletClient</a></li><li><a href="module-wallet.WalletDB.html">WalletDB</a></li><li><a href="module-wallet.WalletKey.html">WalletKey</a></li><li><a href="module-wallet.WalletOptions.html">WalletOptions</a></li><li><a href="module-wallet_records-BlockMapRecord.html">BlockMapRecord</a></li><li><a href="module-wallet_records-BlockMeta.html">BlockMeta</a></li><li><a href="module-wallet_records-ChainState.html">ChainState</a></li><li><a href="module-wallet_records-OutpointMapRecord.html">OutpointMapRecord</a></li><li><a href="module-wallet_records-PathMapRecord.html">PathMapRecord</a></li><li><a href="module-wallet_records-TXMapRecord.html">TXMapRecord</a></li><li><a href="module-wallet_records-TXRecord.html">TXRecord</a></li><li><a href="module-workers.Framer.html">Framer</a></li><li><a href="module-workers.Master.html">Master</a></li><li><a href="module-workers.Parser.html">Parser</a></li><li><a href="module-workers.ParserClient.html">ParserClient</a></li><li><a href="module-workers.Worker.html">Worker</a></li><li><a href="module-workers.WorkerPool.html">WorkerPool</a></li><li><a href="module-workers_packets-ECSignPacket.html">ECSignPacket</a></li><li><a href="module-workers_packets-ECSignResultPacket.html">ECSignResultPacket</a></li><li><a href="module-workers_packets-ECVerifyPacket.html">ECVerifyPacket</a></li><li><a href="module-workers_packets-ECVerifyResultPacket.html">ECVerifyResultPacket</a></li><li><a href="module-workers_packets-ErrorPacket.html">ErrorPacket</a></li><li><a href="module-workers_packets-ErrorResultPacket.html">ErrorResultPacket</a></li><li><a href="module-workers_packets-EventPacket.html">EventPacket</a></li><li><a href="module-workers_packets-LogPacket.html">LogPacket</a></li><li><a href="module-workers_packets-MinePacket.html">MinePacket</a></li><li><a href="module-workers_packets-MineResultPacket.html">MineResultPacket</a></li><li><a href="module-workers_packets-Packet.html">Packet</a></li><li><a href="module-workers_packets-ScryptPacket.html">ScryptPacket</a></li><li><a href="module-workers_packets-ScryptResultPacket.html">ScryptResultPacket</a></li><li><a href="module-workers_packets-SignInputPacket.html">SignInputPacket</a></li><li><a href="module-workers_packets-SignInputResultPacket.html">SignInputResultPacket</a></li><li><a href="module-workers_packets-SignPacket.html">SignPacket</a></li><li><a href="module-workers_packets-SignResultPacket.html">SignResultPacket</a></li><li><a href="module-workers_packets-VerifyInputPacket.html">VerifyInputPacket</a></li><li><a href="module-workers_packets-VerifyInputResultPacket.html">VerifyInputResultPacket</a></li><li><a href="module-workers_packets-VerifyPacket.html">VerifyPacket</a></li><li><a href="module-workers_packets-VerifyResultPacket.html">VerifyResultPacket</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-crypto_pk.ecdsa.html">ecdsa</a></li><li><a href="module-crypto_pk.rsa.html">rsa</a></li></ul><h3>Global</h3><ul><li><a href="global.html"></a></li><li><a href="global.html#DoubleMap">DoubleMap</a></li><li><a href="global.html#StatEntry">StatEntry</a></li></ul>
|
|
</nav>
|
|
|
|
<br class="clear">
|
|
|
|
<footer>
|
|
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Fri Feb 10 2017 09:40:23 GMT-0800 (PST)
|
|
</footer>
|
|
|
|
<script> prettyPrint(); </script>
|
|
<script src="scripts/linenumber.js"> </script>
|
|
</body>
|
|
</html>
|
|
|