Fix backend support for 'liquidtestnet' network
This commit is contained in:
		
							parent
							
								
									1448588e45
								
							
						
					
					
						commit
						331e3b4c3e
					
				@ -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 {
 | 
			
		||||
 | 
			
		||||
@ -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,
 | 
			
		||||
 | 
			
		||||
@ -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();
 | 
			
		||||
 | 
			
		||||
@ -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;
 | 
			
		||||
 | 
			
		||||
@ -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,
 | 
			
		||||
 | 
			
		||||
@ -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)
 | 
			
		||||
      ;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user