From 5193e3533ac2b14d2ad0dd1b8882e36f6ea2737c Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Fri, 13 May 2016 05:53:51 -0700 Subject: [PATCH] halflife. --- lib/bcoin/mempool.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/bcoin/mempool.js b/lib/bcoin/mempool.js index b3c78ea0..b10c0683 100644 --- a/lib/bcoin/mempool.js +++ b/lib/bcoin/mempool.js @@ -865,7 +865,7 @@ Mempool.prototype.removeUnchecked = function removeUnchecked(entry, limit, callb */ Mempool.prototype.getMinRate = function getMinRate() { - var now, halflife, exp; + var now, halflife, size; if (!this.blockSinceBump || this.minFeeRate === 0) return this.minFeeRate; @@ -874,10 +874,11 @@ Mempool.prototype.getMinRate = function getMinRate() { if (now > this.lastFeeUpdate + 10) { halflife = constants.mempool.FEE_HALFLIFE; + size = this.getSize(); - if (this.size < this.maxSize / 4) + if (size < this.maxSize / 4) halflife >>>= 2; - else if (this.size < this.maxSize / 2) + else if (size < this.maxSize / 2) halflife >>>= 1; this.minFeeRate /= Math.pow(2.0, (now - this.lastFeeUpdate) / halflife | 0);