diff --git a/lib/mempool/fees.js b/lib/mempool/fees.js index ef1482ce..4b29ab17 100644 --- a/lib/mempool/fees.js +++ b/lib/mempool/fees.js @@ -697,6 +697,9 @@ PolicyEstimator.prototype.estimateFee = function estimateFee(target, smart) { if (rate < this.network.feeRate) return this.network.feeRate; + if (rate > this.network.maxFeeRate) + return this.network.maxFeeRate; + if (rate < 0) return 0; diff --git a/lib/protocol/network.js b/lib/protocol/network.js index 46363e3c..4144937d 100644 --- a/lib/protocol/network.js +++ b/lib/protocol/network.js @@ -46,6 +46,7 @@ function Network(options) { this.rpcPort = options.rpcPort; this.minRelay = options.minRelay; this.feeRate = options.feeRate; + this.maxFeeRate = options.maxFeeRate; this.selfConnect = options.selfConnect; this.requestMempool = options.requestMempool; this.batchSize = options.batchSize; diff --git a/lib/protocol/networks.js b/lib/protocol/networks.js index 1796d338..7c75f176 100644 --- a/lib/protocol/networks.js +++ b/lib/protocol/networks.js @@ -419,6 +419,14 @@ main.minRelay = 10000; main.feeRate = 50000; +/** + * Maximum normal relay rate. + * @const {Rate} + * @default + */ + +main.maxFeeRate = 150000; + /** * Whether to allow self-connection. * @const {Boolean} @@ -603,6 +611,8 @@ testnet.minRelay = 10000; testnet.feeRate = 20000; +testnet.maxFeeRate = 60000; + testnet.selfConnect = false; testnet.requestMempool = false; @@ -748,6 +758,8 @@ regtest.minRelay = 10000; regtest.feeRate = 20000; +regtest.maxFeeRate = 60000; + regtest.selfConnect = true; regtest.requestMempool = true; @@ -869,6 +881,8 @@ segnet3.minRelay = 10000; segnet3.feeRate = 20000; +segnet3.maxFeeRate = 60000; + segnet3.selfConnect = false; segnet3.requestMempool = true; @@ -1007,6 +1021,8 @@ segnet4.minRelay = 10000; segnet4.feeRate = 20000; +segnet4.maxFeeRate = 60000; + segnet4.selfConnect = false; segnet4.requestMempool = true; @@ -1153,6 +1169,8 @@ simnet.minRelay = 10000; simnet.feeRate = 20000; +simnet.maxFeeRate = 60000; + simnet.selfConnect = true; simnet.requestMempool = false;