diff --git a/lib/mempool/mempool.js b/lib/mempool/mempool.js index c0715bee..365c190a 100644 --- a/lib/mempool/mempool.js +++ b/lib/mempool/mempool.js @@ -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 diff --git a/lib/mining/miner.js b/lib/mining/miner.js index 6b02e475..367f573a 100644 --- a/lib/mining/miner.js +++ b/lib/mining/miner.js @@ -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(); diff --git a/lib/protocol/policy.js b/lib/protocol/policy.js index 37bf1095..25d492a0 100644 --- a/lib/protocol/policy.js +++ b/lib/protocol/policy.js @@ -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