policy: refactor.
This commit is contained in:
parent
5d5bcee9fa
commit
0c194f1d3f
@ -108,48 +108,15 @@ function Mempool(options) {
|
||||
this.paranoid = !!this.options.paranoid;
|
||||
this.replaceByFee = !!this.options.replaceByFee;
|
||||
|
||||
this.maxSize = options.maxSize || Mempool.MAX_SIZE;
|
||||
this.maxOrphans = options.maxOrphans || Mempool.MAX_ORPHANS;
|
||||
this.maxAncestors = options.maxAncestors || Mempool.ANCESTOR_LIMIT;
|
||||
this.expiryTime = options.expiryTime || Mempool.EXPIRY_TIME;
|
||||
this.maxSize = options.maxSize || policy.MEMPOOL_MAX_SIZE;
|
||||
this.maxOrphans = options.maxOrphans || policy.MEMPOOL_MAX_ORPHANS;
|
||||
this.maxAncestors = options.maxAncestors || policy.MEMPOOL_MAX_ANCESTORS;
|
||||
this.expiryTime = options.expiryTime || policy.MEMPOOL_EXPIRY_TIME;
|
||||
this.minRelay = this.network.minRelay;
|
||||
}
|
||||
|
||||
util.inherits(Mempool, AsyncObject);
|
||||
|
||||
/**
|
||||
* Default ancestor limit.
|
||||
* @const {Number}
|
||||
* @default
|
||||
*/
|
||||
|
||||
Mempool.ANCESTOR_LIMIT = 25;
|
||||
|
||||
/**
|
||||
* Default maximum mempool size in bytes.
|
||||
* @const {Number}
|
||||
* @default
|
||||
*/
|
||||
|
||||
Mempool.MAX_SIZE = 100 * 1000000;
|
||||
|
||||
/**
|
||||
* Time at which transactions
|
||||
* fall out of the mempool.
|
||||
* @const {Number}
|
||||
* @default
|
||||
*/
|
||||
|
||||
Mempool.EXPIRY_TIME = 72 * 60 * 60;
|
||||
|
||||
/**
|
||||
* Maximum number of orphan transactions.
|
||||
* @const {Number}
|
||||
* @default
|
||||
*/
|
||||
|
||||
Mempool.MAX_ORPHANS = 100;
|
||||
|
||||
/**
|
||||
* Open the chain, wait for the database to load.
|
||||
* @alias Mempool#open
|
||||
|
||||
@ -53,11 +53,11 @@ function Miner(options) {
|
||||
this.addresses = [];
|
||||
this.coinbaseFlags = new Buffer('mined by bcoin', 'ascii');
|
||||
|
||||
this.minWeight = 0;
|
||||
this.maxWeight = 750000 * consensus.WITNESS_SCALE_FACTOR;
|
||||
this.minWeight = policy.MIN_BLOCK_WEIGHT;
|
||||
this.maxWeight = policy.MAX_BLOCK_WEIGHT;
|
||||
this.priorityWeight = policy.PRIORITY_BLOCK_WEIGHT;
|
||||
this.minPriority = policy.MIN_BLOCK_PRIORITY;
|
||||
this.maxSigops = consensus.MAX_BLOCK_SIGOPS_COST;
|
||||
this.priorityWeight = 50000 * consensus.WITNESS_SCALE_FACTOR;
|
||||
this.minPriority = policy.FREE_THRESHOLD;
|
||||
|
||||
this._initOptions(options);
|
||||
this._init();
|
||||
|
||||
@ -135,12 +135,37 @@ exports.MAX_P2WSH_PUSH = 80;
|
||||
exports.MAX_P2WSH_SIZE = 3600;
|
||||
|
||||
/**
|
||||
* Mempool ancestor limit.
|
||||
* Default ancestor limit.
|
||||
* @const {Number}
|
||||
* @default
|
||||
*/
|
||||
|
||||
exports.ANCESTOR_LIMIT = 25;
|
||||
exports.MEMPOOL_MAX_ANCESTORS = 25;
|
||||
|
||||
/**
|
||||
* Default maximum mempool size in bytes.
|
||||
* @const {Number}
|
||||
* @default
|
||||
*/
|
||||
|
||||
exports.MEMPOOL_MAX_SIZE = 100 * 1000000;
|
||||
|
||||
/**
|
||||
* Time at which transactions
|
||||
* fall out of the mempool.
|
||||
* @const {Number}
|
||||
* @default
|
||||
*/
|
||||
|
||||
exports.MEMPOOL_EXPIRY_TIME = 72 * 60 * 60;
|
||||
|
||||
/**
|
||||
* Maximum number of orphan transactions.
|
||||
* @const {Number}
|
||||
* @default
|
||||
*/
|
||||
|
||||
exports.MEMPOOL_MAX_ORPHANS = 100;
|
||||
|
||||
/**
|
||||
* Block weight to be reached before
|
||||
|
||||
Loading…
Reference in New Issue
Block a user