diff --git a/backend/src/api/common.ts b/backend/src/api/common.ts index 3d575c6dc..e58ffee34 100644 --- a/backend/src/api/common.ts +++ b/backend/src/api/common.ts @@ -109,7 +109,8 @@ export class Common { totalFees += tx.bestDescendant.fee; } - tx.effectiveFeePerVsize = Math.max(config.MEMPOOL.NETWORK === 'liquid' ? 0.1 : 1, totalFees / (totalWeight / 4)); + tx.effectiveFeePerVsize = Math.max(config.MEMPOOL.NETWORK === 'liquid' + || config.MEMPOOL.NETWORK === 'liquidtestnet' ? 0.1 : 1, totalFees / (totalWeight / 4)); tx.cpfpChecked = true; return { diff --git a/backend/src/api/database-migration.ts b/backend/src/api/database-migration.ts index eb00dcc53..8819887f2 100644 --- a/backend/src/api/database-migration.ts +++ b/backend/src/api/database-migration.ts @@ -127,7 +127,7 @@ class DatabaseMigration { const queries: string[] = []; if (version < 1) { - if (config.MEMPOOL.NETWORK !== 'liquid') { + if (config.MEMPOOL.NETWORK !== 'liquid' && config.MEMPOOL.NETWORK !== 'liquidtestnet') { queries.push(`UPDATE statistics SET vsize_1 = vsize_1 + vsize_2, vsize_2 = vsize_3, vsize_3 = vsize_4, vsize_4 = vsize_5, diff --git a/backend/src/api/fee-api.ts b/backend/src/api/fee-api.ts index 5ad64ec8c..14c6d7ed9 100644 --- a/backend/src/api/fee-api.ts +++ b/backend/src/api/fee-api.ts @@ -6,7 +6,7 @@ import projectedBlocks from './mempool-blocks'; class FeeApi { constructor() { } - defaultFee = config.MEMPOOL.NETWORK === 'liquid' ? 0.1 : 1; + defaultFee = config.MEMPOOL.NETWORK === 'liquid' || config.MEMPOOL.NETWORK === 'liquidtestnet' ? 0.1 : 1; public getRecommendedFee() { const pBlocks = projectedBlocks.getMempoolBlocks(); diff --git a/backend/src/api/statistics.ts b/backend/src/api/statistics.ts index 8e7c9e539..f4f2a75d4 100644 --- a/backend/src/api/statistics.ts +++ b/backend/src/api/statistics.ts @@ -90,9 +90,11 @@ class Statistics { memPoolArray.forEach((transaction) => { for (let i = 0; i < logFees.length; i++) { if ( - (config.MEMPOOL.NETWORK === 'liquid' && (i === lastItem || transaction.effectiveFeePerVsize * 10 < logFees[i + 1])) + ((config.MEMPOOL.NETWORK === 'liquid' || config.MEMPOOL.NETWORK === 'liquidtestnet') + && (i === lastItem || transaction.effectiveFeePerVsize * 10 < logFees[i + 1])) || - (config.MEMPOOL.NETWORK !== 'liquid' && (i === lastItem || transaction.effectiveFeePerVsize < logFees[i + 1])) + ((config.MEMPOOL.NETWORK !== 'liquid' && config.MEMPOOL.NETWORK !== 'liquidtestnet') + && (i === lastItem || transaction.effectiveFeePerVsize < logFees[i + 1])) ) { if (weightVsizeFees[logFees[i]]) { weightVsizeFees[logFees[i]] += transaction.vsize; diff --git a/backend/src/api/transaction-utils.ts b/backend/src/api/transaction-utils.ts index 04d6f3259..d45e54ac8 100644 --- a/backend/src/api/transaction-utils.ts +++ b/backend/src/api/transaction-utils.ts @@ -31,7 +31,8 @@ class TransactionUtils { // @ts-ignore return transaction; } - const feePerVbytes = Math.max(config.MEMPOOL.NETWORK === 'liquid' ? 0.1 : 1, (transaction.fee || 0) / (transaction.weight / 4)); + const feePerVbytes = Math.max(config.MEMPOOL.NETWORK === 'liquid' || config.MEMPOOL.NETWORK === 'liquidtestnet' ? 0.1 : 1, + (transaction.fee || 0) / (transaction.weight / 4)); const transactionExtended: TransactionExtended = Object.assign({ vsize: Math.round(transaction.weight / 4), feePerVsize: feePerVbytes, diff --git a/backend/src/index.ts b/backend/src/index.ts index 78c99f016..9ea4e0b05 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -96,7 +96,7 @@ class Server { statistics.startStatistics(); } - if (config.MEMPOOL.NETWORK === 'liquid') { + if (config.MEMPOOL.NETWORK === 'liquid' || config.MEMPOOL.NETWORK === 'liquidtestnet') { icons.loadIcons(); } @@ -156,7 +156,7 @@ class Server { if (this.wss) { websocketHandler.setWebsocketServer(this.wss); } - if (config.MEMPOOL.NETWORK === 'liquid' && config.DATABASE.ENABLED) { + if ((config.MEMPOOL.NETWORK === 'liquid' || config.MEMPOOL.NETWORK === 'liquidtestnet') && config.DATABASE.ENABLED) { blocks.setNewBlockCallback(async () => { try { await elementsParser.$parse(); @@ -283,14 +283,14 @@ class Server { ; } - if (config.MEMPOOL.NETWORK === 'liquid') { + if (config.MEMPOOL.NETWORK === 'liquid' || config.MEMPOOL.NETWORK === 'liquidtestnet') { this.app .get(config.MEMPOOL.API_URL_PREFIX + 'assets/icons', routes.getAllLiquidIcon) .get(config.MEMPOOL.API_URL_PREFIX + 'asset/:assetId/icon', routes.getLiquidIcon) ; } - if (config.MEMPOOL.NETWORK === 'liquid' && config.DATABASE.ENABLED) { + if ((config.MEMPOOL.NETWORK === 'liquid' || config.MEMPOOL.NETWORK === 'liquidtestnet') && config.DATABASE.ENABLED) { this.app .get(config.MEMPOOL.API_URL_PREFIX + 'liquid/pegs/month', routes.$getElementsPegsByMonth) ;