Fix: Show fee box on Testnet and Liquid.

Use 0.1 sat/vB as minimum liquid fee.
This commit is contained in:
softsimon
2020-09-27 18:12:36 +07:00
parent db12d99723
commit 5f8ba96f8f
4 changed files with 13 additions and 7 deletions

View File

@@ -8,6 +8,7 @@
"DB_DISABLED": false,
"API_ENDPOINT": "/api/v1/",
"ELECTRS_POLL_RATE_MS": 2000,
"LIQUID": true,
"MEMPOOL_REFRESH_RATE_MS": 2000,
"DEFAULT_PROJECTED_BLOCKS_AMOUNT": 8,
"KEEP_BLOCK_AMOUNT": 24,

View File

@@ -1,8 +1,11 @@
const config = require('../../mempool-config.json');
import projectedBlocks from './mempool-blocks';
class FeeApi {
constructor() { }
defaultFee = config.LIQUID ? 0.1 : 1;
public getRecommendedFee() {
const pBlocks = projectedBlocks.getMempoolBlocks();
if (!pBlocks.length) {
@@ -15,11 +18,11 @@ class FeeApi {
let firstMedianFee = Math.ceil(pBlocks[0].medianFee);
if (pBlocks.length === 1 && pBlocks[0].blockVSize <= 500000) {
firstMedianFee = 1;
firstMedianFee = this.defaultFee;
}
const secondMedianFee = pBlocks[1] ? Math.ceil(pBlocks[1].medianFee) : 1;
const thirdMedianFee = pBlocks[2] ? Math.ceil(pBlocks[2].medianFee) : 1;
const secondMedianFee = pBlocks[1] ? Math.ceil(pBlocks[1].medianFee) : this.defaultFee;
const thirdMedianFee = pBlocks[2] ? Math.ceil(pBlocks[2].medianFee) : this.defaultFee;
return {
'fastestFee': firstMedianFee,