Merge pull request #3379 from mempool/nymkappa/testnet-signet-price-zero
Don't fetch prices on signet/testnet, always show 0
This commit is contained in:
		
						commit
						41a6674fad
					
				@ -7,7 +7,7 @@ import cpfpRepository from '../repositories/CpfpRepository';
 | 
				
			|||||||
import { RowDataPacket } from 'mysql2';
 | 
					import { RowDataPacket } from 'mysql2';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class DatabaseMigration {
 | 
					class DatabaseMigration {
 | 
				
			||||||
  private static currentVersion = 58;
 | 
					  private static currentVersion = 59;
 | 
				
			||||||
  private queryTimeout = 3600_000;
 | 
					  private queryTimeout = 3600_000;
 | 
				
			||||||
  private statisticsAddedIndexed = false;
 | 
					  private statisticsAddedIndexed = false;
 | 
				
			||||||
  private uniqueLogs: string[] = [];
 | 
					  private uniqueLogs: string[] = [];
 | 
				
			||||||
@ -510,6 +510,11 @@ class DatabaseMigration {
 | 
				
			|||||||
      // We only run some migration queries for this version
 | 
					      // We only run some migration queries for this version
 | 
				
			||||||
      await this.updateToSchemaVersion(58);
 | 
					      await this.updateToSchemaVersion(58);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (databaseSchemaVersion < 59 && (config.MEMPOOL.NETWORK === 'signet' || config.MEMPOOL.NETWORK === 'testnet')) {
 | 
				
			||||||
 | 
					      // https://github.com/mempool/mempool/issues/3360
 | 
				
			||||||
 | 
					      await this.$executeQuery(`TRUNCATE prices`);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /**
 | 
					  /**
 | 
				
			||||||
 | 
				
			|||||||
@ -73,6 +73,11 @@ class PriceUpdater {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  public async $run(): Promise<void> {
 | 
					  public async $run(): Promise<void> {
 | 
				
			||||||
 | 
					    if (config.MEMPOOL.NETWORK === 'signet' || config.MEMPOOL.NETWORK === 'testnet') {
 | 
				
			||||||
 | 
					      // Coins have no value on testnet/signet, so we want to always show 0
 | 
				
			||||||
 | 
					      return;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (this.running === true) {
 | 
					    if (this.running === true) {
 | 
				
			||||||
      return;
 | 
					      return;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -88,7 +93,7 @@ class PriceUpdater {
 | 
				
			|||||||
      if (this.historyInserted === false && config.DATABASE.ENABLED === true) {
 | 
					      if (this.historyInserted === false && config.DATABASE.ENABLED === true) {
 | 
				
			||||||
        await this.$insertHistoricalPrices();
 | 
					        await this.$insertHistoricalPrices();
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    } catch (e) {
 | 
					    } catch (e: any) {
 | 
				
			||||||
      logger.err(`Cannot save BTC prices in db. Reason: ${e instanceof Error ? e.message : e}`, logger.tags.mining);
 | 
					      logger.err(`Cannot save BTC prices in db. Reason: ${e instanceof Error ? e.message : e}`, logger.tags.mining);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user