Merge branch 'master' into nymkappa/use-core-again-because-esplora-is-lol

This commit is contained in:
wiz 2023-03-03 17:39:55 +09:00 committed by GitHub
commit d16bda0630
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 79 additions and 63 deletions

View File

@ -1,4 +1,5 @@
{ {
"editor.tabSize": 2, "editor.tabSize": 2,
"typescript.preferences.importModuleSpecifier": "relative",
"typescript.tsdk": "./backend/node_modules/typescript/lib" "typescript.tsdk": "./backend/node_modules/typescript/lib"
} }

View File

@ -39,6 +39,10 @@ class PoolsParser {
* @param pools * @param pools
*/ */
public async migratePoolsJson(): Promise<void> { public async migratePoolsJson(): Promise<void> {
// We also need to wipe the backend cache to make sure we don't serve blocks with
// the wrong mining pool (usually happen with unknown blocks)
diskCache.wipeCache();
await this.$insertUnknownPool(); await this.$insertUnknownPool();
for (const pool of this.miningPools) { for (const pool of this.miningPools) {
@ -142,10 +146,6 @@ class PoolsParser {
WHERE pool_id = ?`, WHERE pool_id = ?`,
[pool.id] [pool.id]
); );
// We also need to wipe the backend cache to make sure we don't serve blocks with
// the wrong mining pool (usually happen with unknown blocks)
diskCache.wipeCache();
} }
private async $deleteUnknownBlocks(): Promise<void> { private async $deleteUnknownBlocks(): Promise<void> {
@ -156,10 +156,6 @@ class PoolsParser {
WHERE pool_id = ? AND height >= 130635`, WHERE pool_id = ? AND height >= 130635`,
[unknownPool[0].id] [unknownPool[0].id]
); );
// We also need to wipe the backend cache to make sure we don't serve blocks with
// the wrong mining pool (usually happen with unknown blocks)
diskCache.wipeCache();
} }
} }

View File

@ -113,6 +113,7 @@ class Server {
this.setUpWebsocketHandling(); this.setUpWebsocketHandling();
await poolsUpdater.updatePoolsJson(); // Needs to be done before loading the disk cache because we sometimes wipe it
await syncAssets.syncAssets$(); await syncAssets.syncAssets$();
if (config.MEMPOOL.ENABLED) { if (config.MEMPOOL.ENABLED) {
diskCache.loadMempoolCache(); diskCache.loadMempoolCache();
@ -171,7 +172,6 @@ class Server {
logger.debug(msg); logger.debug(msg);
} }
} }
await poolsUpdater.updatePoolsJson();
await blocks.$updateBlocks(); await blocks.$updateBlocks();
await memPool.$updateMempool(); await memPool.$updateMempool();
indexer.$run(); indexer.$run();

View File

@ -1,4 +1,4 @@
import { defineConfig } from 'cypress' import { defineConfig } from 'cypress';
export default defineConfig({ export default defineConfig({
projectId: 'ry4br7', projectId: 'ry4br7',
@ -12,12 +12,18 @@ export default defineConfig({
}, },
chromeWebSecurity: false, chromeWebSecurity: false,
e2e: { e2e: {
// We've imported your old cypress plugins here. setupNodeEvents(on: any, config: any) {
// You may want to clean this up later by importing these. const fs = require('fs');
setupNodeEvents(on, config) { const CONFIG_FILE = 'mempool-frontend-config.json';
return require('./cypress/plugins/index.js')(on, config) if (fs.existsSync(CONFIG_FILE)) {
let contents = JSON.parse(fs.readFileSync(CONFIG_FILE, 'utf8'));
config.env.BASE_MODULE = contents.BASE_MODULE ? contents.BASE_MODULE : 'mempool';
} else {
config.env.BASE_MODULE = 'mempool';
}
return config;
}, },
baseUrl: 'http://localhost:4200', baseUrl: 'http://localhost:4200',
specPattern: 'cypress/e2e/**/*.{js,jsx,ts,tsx}', specPattern: 'cypress/e2e/**/*.{js,jsx,ts,tsx}',
}, },
}) });

View File

@ -1,5 +1,5 @@
describe('Bisq', () => { describe('Bisq', () => {
const baseModule = Cypress.env("BASE_MODULE"); const baseModule = Cypress.env('BASE_MODULE');
const basePath = ''; const basePath = '';
beforeEach(() => { beforeEach(() => {
@ -20,7 +20,7 @@ describe('Bisq', () => {
cy.waitForSkeletonGone(); cy.waitForSkeletonGone();
}); });
describe("transactions", () => { describe('transactions', () => {
it('loads the transactions screen', () => { it('loads the transactions screen', () => {
cy.visit(`${basePath}`); cy.visit(`${basePath}`);
cy.waitForSkeletonGone(); cy.waitForSkeletonGone();
@ -30,9 +30,9 @@ describe('Bisq', () => {
}); });
const filters = [ const filters = [
"Asset listing fee", "Blind vote", "Compensation request", 'Asset listing fee', 'Blind vote', 'Compensation request',
"Genesis", "Irregular", "Lockup", "Pay trade fee", "Proof of burn", 'Genesis', 'Irregular', 'Lockup', 'Pay trade fee', 'Proof of burn',
"Proposal", "Reimbursement request", "Transfer BSQ", "Unlock", "Vote reveal" 'Proposal', 'Reimbursement request', 'Transfer BSQ', 'Unlock', 'Vote reveal'
]; ];
filters.forEach((filter) => { filters.forEach((filter) => {
it.only(`filters the transaction screen by ${filter}`, () => { it.only(`filters the transaction screen by ${filter}`, () => {
@ -49,7 +49,7 @@ describe('Bisq', () => {
}); });
}); });
it("filters using multiple criteria", () => { it('filters using multiple criteria', () => {
const filters = ['Proposal', 'Lockup', 'Unlock']; const filters = ['Proposal', 'Lockup', 'Unlock'];
cy.visit(`${basePath}/transactions`); cy.visit(`${basePath}/transactions`);
cy.waitForSkeletonGone(); cy.waitForSkeletonGone();

View File

@ -1,5 +1,5 @@
describe('Liquid', () => { describe('Liquid', () => {
const baseModule = Cypress.env("BASE_MODULE"); const baseModule = Cypress.env('BASE_MODULE');
const basePath = ''; const basePath = '';
beforeEach(() => { beforeEach(() => {

View File

@ -1,5 +1,5 @@
describe('Liquid Testnet', () => { describe('Liquid Testnet', () => {
const baseModule = Cypress.env("BASE_MODULE"); const baseModule = Cypress.env('BASE_MODULE');
const basePath = '/testnet'; const basePath = '/testnet';
beforeEach(() => { beforeEach(() => {

View File

@ -1,6 +1,6 @@
import { emitMempoolInfo, dropWebSocket } from "../../support/websocket"; import { emitMempoolInfo, dropWebSocket } from '../../support/websocket';
const baseModule = Cypress.env("BASE_MODULE"); const baseModule = Cypress.env('BASE_MODULE');
//Credit: https://github.com/bahmutov/cypress-examples/blob/6cedb17f83a3bb03ded13cf1d6a3f0656ca2cdf5/docs/recipes/overlapping-elements.md //Credit: https://github.com/bahmutov/cypress-examples/blob/6cedb17f83a3bb03ded13cf1d6a3f0656ca2cdf5/docs/recipes/overlapping-elements.md
@ -339,14 +339,14 @@ describe('Mainnet', () => {
cy.visit('/'); cy.visit('/');
cy.waitForSkeletonGone(); cy.waitForSkeletonGone();
cy.changeNetwork("testnet"); cy.changeNetwork('testnet');
cy.changeNetwork("signet"); cy.changeNetwork('signet');
cy.changeNetwork("mainnet"); cy.changeNetwork('mainnet');
}); });
it.skip('loads the dashboard with the skeleton blocks', () => { it.skip('loads the dashboard with the skeleton blocks', () => {
cy.mockMempoolSocket(); cy.mockMempoolSocket();
cy.visit("/"); cy.visit('/');
cy.get(':nth-child(1) > #bitcoin-block-0').should('be.visible'); cy.get(':nth-child(1) > #bitcoin-block-0').should('be.visible');
cy.get(':nth-child(2) > #bitcoin-block-0').should('be.visible'); cy.get(':nth-child(2) > #bitcoin-block-0').should('be.visible');
cy.get(':nth-child(3) > #bitcoin-block-0').should('be.visible'); cy.get(':nth-child(3) > #bitcoin-block-0').should('be.visible');

View File

@ -1,4 +1,4 @@
const baseModule = Cypress.env("BASE_MODULE"); const baseModule = Cypress.env('BASE_MODULE');
describe('Mainnet - Mining Features', () => { describe('Mainnet - Mining Features', () => {
beforeEach(() => { beforeEach(() => {

View File

@ -1,6 +1,6 @@
import { emitMempoolInfo } from "../../support/websocket"; import { emitMempoolInfo } from '../../support/websocket';
const baseModule = Cypress.env("BASE_MODULE"); const baseModule = Cypress.env('BASE_MODULE');
describe('Signet', () => { describe('Signet', () => {
beforeEach(() => { beforeEach(() => {
@ -25,7 +25,7 @@ describe('Signet', () => {
it.skip('loads the dashboard with the skeleton blocks', () => { it.skip('loads the dashboard with the skeleton blocks', () => {
cy.mockMempoolSocket(); cy.mockMempoolSocket();
cy.visit("/signet"); cy.visit('/signet');
cy.get(':nth-child(1) > #bitcoin-block-0').should('be.visible'); cy.get(':nth-child(1) > #bitcoin-block-0').should('be.visible');
cy.get(':nth-child(2) > #bitcoin-block-0').should('be.visible'); cy.get(':nth-child(2) > #bitcoin-block-0').should('be.visible');
cy.get(':nth-child(3) > #bitcoin-block-0').should('be.visible'); cy.get(':nth-child(3) > #bitcoin-block-0').should('be.visible');
@ -35,7 +35,7 @@ describe('Signet', () => {
emitMempoolInfo({ emitMempoolInfo({
'params': { 'params': {
"network": "signet" 'network': 'signet'
} }
}); });

View File

@ -1,6 +1,6 @@
import { confirmAddress, emitMempoolInfo, sendWsMock, showNewTx, startTrackingAddress } from "../../support/websocket"; import { emitMempoolInfo } from '../../support/websocket';
const baseModule = Cypress.env("BASE_MODULE"); const baseModule = Cypress.env('BASE_MODULE');
describe('Testnet', () => { describe('Testnet', () => {
beforeEach(() => { beforeEach(() => {
@ -25,7 +25,7 @@ describe('Testnet', () => {
it.skip('loads the dashboard with the skeleton blocks', () => { it.skip('loads the dashboard with the skeleton blocks', () => {
cy.mockMempoolSocket(); cy.mockMempoolSocket();
cy.visit("/testnet"); cy.visit('/testnet');
cy.get(':nth-child(1) > #bitcoin-block-0').should('be.visible'); cy.get(':nth-child(1) > #bitcoin-block-0').should('be.visible');
cy.get(':nth-child(2) > #bitcoin-block-0').should('be.visible'); cy.get(':nth-child(2) > #bitcoin-block-0').should('be.visible');
cy.get(':nth-child(3) > #bitcoin-block-0').should('be.visible'); cy.get(':nth-child(3) > #bitcoin-block-0').should('be.visible');

View File

@ -1,13 +0,0 @@
const fs = require('fs');
const CONFIG_FILE = 'mempool-frontend-config.json';
module.exports = (on, config) => {
if (fs.existsSync(CONFIG_FILE)) {
let contents = JSON.parse(fs.readFileSync(CONFIG_FILE, 'utf8'));
config.env.BASE_MODULE = contents.BASE_MODULE ? contents.BASE_MODULE : 'mempool';
} else {
config.env.BASE_MODULE = 'mempool';
}
return config;
}

View File

@ -58,7 +58,7 @@
}, },
"optionalDependencies": { "optionalDependencies": {
"@cypress/schematic": "^2.4.0", "@cypress/schematic": "^2.4.0",
"cypress": "^12.3.0", "cypress": "^12.7.0",
"cypress-fail-on-console-error": "~4.0.2", "cypress-fail-on-console-error": "~4.0.2",
"cypress-wait-until": "^1.7.2", "cypress-wait-until": "^1.7.2",
"mock-socket": "~9.1.5", "mock-socket": "~9.1.5",
@ -7010,9 +7010,9 @@
"peer": true "peer": true
}, },
"node_modules/cypress": { "node_modules/cypress": {
"version": "12.3.0", "version": "12.7.0",
"resolved": "https://registry.npmjs.org/cypress/-/cypress-12.3.0.tgz", "resolved": "https://registry.npmjs.org/cypress/-/cypress-12.7.0.tgz",
"integrity": "sha512-ZQNebibi6NBt51TRxRMYKeFvIiQZ01t50HSy7z/JMgRVqBUey3cdjog5MYEbzG6Ktti5ckDt1tfcC47lmFwXkw==", "integrity": "sha512-7rq+nmhzz0u6yabCFyPtADU2OOrYt6pvUau9qV7xyifJ/hnsaw/vkr0tnLlcuuQKUAOC1v1M1e4Z0zG7S0IAvA==",
"hasInstallScript": true, "hasInstallScript": true,
"optional": true, "optional": true,
"dependencies": { "dependencies": {
@ -7033,7 +7033,7 @@
"commander": "^5.1.0", "commander": "^5.1.0",
"common-tags": "^1.8.0", "common-tags": "^1.8.0",
"dayjs": "^1.10.4", "dayjs": "^1.10.4",
"debug": "^4.3.2", "debug": "^4.3.4",
"enquirer": "^2.3.6", "enquirer": "^2.3.6",
"eventemitter2": "6.4.7", "eventemitter2": "6.4.7",
"execa": "4.1.0", "execa": "4.1.0",
@ -7159,6 +7159,23 @@
"node": ">= 6" "node": ">= 6"
} }
}, },
"node_modules/cypress/node_modules/debug": {
"version": "4.3.4",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
"integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
"optional": true,
"dependencies": {
"ms": "2.1.2"
},
"engines": {
"node": ">=6.0"
},
"peerDependenciesMeta": {
"supports-color": {
"optional": true
}
}
},
"node_modules/cypress/node_modules/execa": { "node_modules/cypress/node_modules/execa": {
"version": "4.1.0", "version": "4.1.0",
"resolved": "https://registry.npmjs.org/execa/-/execa-4.1.0.tgz", "resolved": "https://registry.npmjs.org/execa/-/execa-4.1.0.tgz",
@ -22276,9 +22293,9 @@
"peer": true "peer": true
}, },
"cypress": { "cypress": {
"version": "12.3.0", "version": "12.7.0",
"resolved": "https://registry.npmjs.org/cypress/-/cypress-12.3.0.tgz", "resolved": "https://registry.npmjs.org/cypress/-/cypress-12.7.0.tgz",
"integrity": "sha512-ZQNebibi6NBt51TRxRMYKeFvIiQZ01t50HSy7z/JMgRVqBUey3cdjog5MYEbzG6Ktti5ckDt1tfcC47lmFwXkw==", "integrity": "sha512-7rq+nmhzz0u6yabCFyPtADU2OOrYt6pvUau9qV7xyifJ/hnsaw/vkr0tnLlcuuQKUAOC1v1M1e4Z0zG7S0IAvA==",
"optional": true, "optional": true,
"requires": { "requires": {
"@cypress/request": "^2.88.10", "@cypress/request": "^2.88.10",
@ -22298,7 +22315,7 @@
"commander": "^5.1.0", "commander": "^5.1.0",
"common-tags": "^1.8.0", "common-tags": "^1.8.0",
"dayjs": "^1.10.4", "dayjs": "^1.10.4",
"debug": "^4.3.2", "debug": "^4.3.4",
"enquirer": "^2.3.6", "enquirer": "^2.3.6",
"eventemitter2": "6.4.7", "eventemitter2": "6.4.7",
"execa": "4.1.0", "execa": "4.1.0",
@ -22382,6 +22399,15 @@
"integrity": "sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg==", "integrity": "sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg==",
"optional": true "optional": true
}, },
"debug": {
"version": "4.3.4",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
"integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
"optional": true,
"requires": {
"ms": "2.1.2"
}
},
"execa": { "execa": {
"version": "4.1.0", "version": "4.1.0",
"resolved": "https://registry.npmjs.org/execa/-/execa-4.1.0.tgz", "resolved": "https://registry.npmjs.org/execa/-/execa-4.1.0.tgz",

View File

@ -110,7 +110,7 @@
}, },
"optionalDependencies": { "optionalDependencies": {
"@cypress/schematic": "^2.4.0", "@cypress/schematic": "^2.4.0",
"cypress": "^12.3.0", "cypress": "^12.7.0",
"cypress-fail-on-console-error": "~4.0.2", "cypress-fail-on-console-error": "~4.0.2",
"cypress-wait-until": "^1.7.2", "cypress-wait-until": "^1.7.2",
"mock-socket": "~9.1.5", "mock-socket": "~9.1.5",
@ -119,4 +119,4 @@
"scarfSettings": { "scarfSettings": {
"enabled": false "enabled": false
} }
} }

View File

@ -1,8 +1,8 @@
import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core'; import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core';
import { map, Observable } from 'rxjs'; import { map, Observable } from 'rxjs';
import { StateService } from 'src/app/services/state.service';
import { INodesRanking, ITopNodesPerCapacity } from '../../../interfaces/node-api.interface'; import { INodesRanking, ITopNodesPerCapacity } from '../../../interfaces/node-api.interface';
import { SeoService } from '../../../services/seo.service'; import { SeoService } from '../../../services/seo.service';
import { StateService } from '../../../services/state.service';
import { GeolocationData } from '../../../shared/components/geolocation/geolocation.component'; import { GeolocationData } from '../../../shared/components/geolocation/geolocation.component';
import { LightningApiService } from '../../lightning-api.service'; import { LightningApiService } from '../../lightning-api.service';

View File

@ -1,7 +1,7 @@
import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core'; import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core';
import { map, Observable } from 'rxjs'; import { map, Observable } from 'rxjs';
import { StateService } from 'src/app/services/state.service';
import { INodesRanking, ITopNodesPerChannels } from '../../../interfaces/node-api.interface'; import { INodesRanking, ITopNodesPerChannels } from '../../../interfaces/node-api.interface';
import { StateService } from '../../../services/state.service';
import { GeolocationData } from '../../../shared/components/geolocation/geolocation.component'; import { GeolocationData } from '../../../shared/components/geolocation/geolocation.component';
import { LightningApiService } from '../../lightning-api.service'; import { LightningApiService } from '../../lightning-api.service';