-
From ec0d8320f624e62681c4590d6a39d67ff4a4cfa7 Mon Sep 17 00:00:00 2001
From: Felipe Knorr Kuhn <100320+knorrium@users.noreply.github.com>
Date: Mon, 13 Feb 2023 16:58:25 -0800
Subject: [PATCH 04/15] Update mainnet tests: increase blocks to 22, update
locators and skip a test
---
frontend/cypress/e2e/mainnet/mainnet.spec.ts | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/frontend/cypress/e2e/mainnet/mainnet.spec.ts b/frontend/cypress/e2e/mainnet/mainnet.spec.ts
index d6fe94dac..5ab3f9ce9 100644
--- a/frontend/cypress/e2e/mainnet/mainnet.spec.ts
+++ b/frontend/cypress/e2e/mainnet/mainnet.spec.ts
@@ -64,7 +64,7 @@ describe('Mainnet', () => {
it('loads the status screen', () => {
cy.visit('/status');
cy.get('#mempool-block-0').should('be.visible');
- cy.get('[id^="bitcoin-block-"]').should('have.length', 8);
+ cy.get('[id^="bitcoin-block-"]').should('have.length', 22);
cy.get('.footer').should('be.visible');
cy.get('.row > :nth-child(1)').invoke('text').then((text) => {
expect(text).to.match(/Incoming transactions.* vB\/s/);
@@ -219,11 +219,11 @@ describe('Mainnet', () => {
describe('blocks navigation', () => {
describe('keyboard events', () => {
- it('loads first blockchain blocks visible and keypress arrow right', () => {
+ it('loads first blockchain block visible and keypress arrow right', () => {
cy.viewport('macbook-16');
cy.visit('/');
cy.waitForSkeletonGone();
- cy.get('.blockchain-blocks-0 > a').click().then(() => {
+ cy.get('[data-cy="bitcoin-block-offset-0-index-0"]').click().then(() => {
cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').should('not.exist');
cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible');
cy.waitForPageIdle();
@@ -233,11 +233,11 @@ describe('Mainnet', () => {
});
});
- it('loads first blockchain blocks visible and keypress arrow left', () => {
+ it('loads first blockchain block visible and keypress arrow left', () => {
cy.viewport('macbook-16');
cy.visit('/');
cy.waitForSkeletonGone();
- cy.get('.blockchain-blocks-0 > a').click().then(() => {
+ cy.get('[data-cy="bitcoin-block-offset-0-index-0"]').click().then(() => {
cy.waitForPageIdle();
cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').should('not.exist');
cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible');
@@ -246,11 +246,11 @@ describe('Mainnet', () => {
});
});
- it('loads last blockchain blocks and keypress arrow right', () => {
+ it.skip('loads last blockchain block and keypress arrow right', () => { //Skip for now as "last" doesn't really work with infinite scrolling
cy.viewport('macbook-16');
cy.visit('/');
cy.waitForSkeletonGone();
- cy.get('.blockchain-blocks-4 > a').click().then(() => {
+ cy.get('bitcoin-block-offset-0-index-7').click().then(() => {
cy.waitForPageIdle();
// block 6
@@ -309,7 +309,7 @@ describe('Mainnet', () => {
cy.viewport('macbook-16');
cy.visit('/');
cy.waitForSkeletonGone();
- cy.get('.blockchain-blocks-0 > a').click().then(() => {
+ cy.get('[data-cy="bitcoin-block-offset-0-index-0"]').click().then(() => {
cy.waitForPageIdle();
cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').should('not.exist');
cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible');
From 87202ea9f831fce47885260bbc72c755a94fc9c9 Mon Sep 17 00:00:00 2001
From: Mononaut
Date: Wed, 15 Feb 2023 09:26:12 -0600
Subject: [PATCH 05/15] fix liquid address table overflow
---
.../components/address/address.component.html | 4 ++--
.../components/address/address.component.scss | 17 +++++++++++++++++
2 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/frontend/src/app/components/address/address.component.html b/frontend/src/app/components/address/address.component.html
index d3b23315a..ae2d7ba9c 100644
--- a/frontend/src/app/components/address/address.component.html
+++ b/frontend/src/app/components/address/address.component.html
@@ -1,4 +1,4 @@
-
+
Address
@@ -15,7 +15,7 @@
-
+
Unconfidential |
diff --git a/frontend/src/app/components/address/address.component.scss b/frontend/src/app/components/address/address.component.scss
index bb1308a43..37abcc49e 100644
--- a/frontend/src/app/components/address/address.component.scss
+++ b/frontend/src/app/components/address/address.component.scss
@@ -91,3 +91,20 @@ h1 {
margin-bottom: 10px;
}
}
+
+.liquid-address {
+ .address-table {
+ table-layout: fixed;
+
+ tr td:first-child {
+ width: 170px;
+ }
+ tr td:last-child {
+ width: 80%;
+ }
+ }
+
+ .qrcode-col {
+ flex-grow: 0.5;
+ }
+}
From d0e52f3695e3faccb6545c122b2cd4e80e30d717 Mon Sep 17 00:00:00 2001
From: nymkappa <1612910616@pm.me>
Date: Thu, 16 Feb 2023 09:44:52 +0900
Subject: [PATCH 06/15] Remove `config.MEMPOOL.PRICE_FEED_UPDATE_INTERVAL`
---
backend/mempool-config.sample.json | 1 -
backend/src/__fixtures__/mempool-config.template.json | 1 -
backend/src/__tests__/config.test.ts | 1 -
backend/src/config.ts | 2 --
docker/README.md | 2 --
docker/backend/mempool-config.json | 1 -
docker/backend/start.sh | 2 --
7 files changed, 10 deletions(-)
diff --git a/backend/mempool-config.sample.json b/backend/mempool-config.sample.json
index f8417f0e7..5ebb25ea5 100644
--- a/backend/mempool-config.sample.json
+++ b/backend/mempool-config.sample.json
@@ -15,7 +15,6 @@
"MEMPOOL_BLOCKS_AMOUNT": 8,
"INDEXING_BLOCKS_AMOUNT": 11000,
"BLOCKS_SUMMARIES_INDEXING": false,
- "PRICE_FEED_UPDATE_INTERVAL": 600,
"USE_SECOND_NODE_FOR_MINFEE": false,
"EXTERNAL_ASSETS": [],
"EXTERNAL_MAX_RETRY": 1,
diff --git a/backend/src/__fixtures__/mempool-config.template.json b/backend/src/__fixtures__/mempool-config.template.json
index f15d9c328..9d8a7e900 100644
--- a/backend/src/__fixtures__/mempool-config.template.json
+++ b/backend/src/__fixtures__/mempool-config.template.json
@@ -16,7 +16,6 @@
"BLOCK_WEIGHT_UNITS": 6,
"INITIAL_BLOCKS_AMOUNT": 7,
"MEMPOOL_BLOCKS_AMOUNT": 8,
- "PRICE_FEED_UPDATE_INTERVAL": 9,
"USE_SECOND_NODE_FOR_MINFEE": 10,
"EXTERNAL_ASSETS": 11,
"EXTERNAL_MAX_RETRY": 12,
diff --git a/backend/src/__tests__/config.test.ts b/backend/src/__tests__/config.test.ts
index 88083f479..8b011d833 100644
--- a/backend/src/__tests__/config.test.ts
+++ b/backend/src/__tests__/config.test.ts
@@ -29,7 +29,6 @@ describe('Mempool Backend Config', () => {
INITIAL_BLOCKS_AMOUNT: 8,
MEMPOOL_BLOCKS_AMOUNT: 8,
INDEXING_BLOCKS_AMOUNT: 11000,
- PRICE_FEED_UPDATE_INTERVAL: 600,
USE_SECOND_NODE_FOR_MINFEE: false,
EXTERNAL_ASSETS: [],
EXTERNAL_MAX_RETRY: 1,
diff --git a/backend/src/config.ts b/backend/src/config.ts
index a5736996f..2cda8d85b 100644
--- a/backend/src/config.ts
+++ b/backend/src/config.ts
@@ -19,7 +19,6 @@ interface IConfig {
MEMPOOL_BLOCKS_AMOUNT: number;
INDEXING_BLOCKS_AMOUNT: number;
BLOCKS_SUMMARIES_INDEXING: boolean;
- PRICE_FEED_UPDATE_INTERVAL: number;
USE_SECOND_NODE_FOR_MINFEE: boolean;
EXTERNAL_ASSETS: string[];
EXTERNAL_MAX_RETRY: number;
@@ -141,7 +140,6 @@ const defaults: IConfig = {
'MEMPOOL_BLOCKS_AMOUNT': 8,
'INDEXING_BLOCKS_AMOUNT': 11000, // 0 = disable indexing, -1 = index all blocks
'BLOCKS_SUMMARIES_INDEXING': false,
- 'PRICE_FEED_UPDATE_INTERVAL': 600,
'USE_SECOND_NODE_FOR_MINFEE': false,
'EXTERNAL_ASSETS': [],
'EXTERNAL_MAX_RETRY': 1,
diff --git a/docker/README.md b/docker/README.md
index 1c10a5e15..69bb96030 100644
--- a/docker/README.md
+++ b/docker/README.md
@@ -101,7 +101,6 @@ Below we list all settings from `mempool-config.json` and the corresponding over
"INITIAL_BLOCKS_AMOUNT": 8,
"MEMPOOL_BLOCKS_AMOUNT": 8,
"BLOCKS_SUMMARIES_INDEXING": false,
- "PRICE_FEED_UPDATE_INTERVAL": 600,
"USE_SECOND_NODE_FOR_MINFEE": false,
"EXTERNAL_ASSETS": ["https://raw.githubusercontent.com/mempool/mining-pools/master/pools.json"],
"STDOUT_LOG_MIN_PRIORITY": "info",
@@ -132,7 +131,6 @@ Corresponding `docker-compose.yml` overrides:
MEMPOOL_INITIAL_BLOCKS_AMOUNT: ""
MEMPOOL_MEMPOOL_BLOCKS_AMOUNT: ""
MEMPOOL_BLOCKS_SUMMARIES_INDEXING: ""
- MEMPOOL_PRICE_FEED_UPDATE_INTERVAL: ""
MEMPOOL_USE_SECOND_NODE_FOR_MINFEE: ""
MEMPOOL_EXTERNAL_ASSETS: ""
MEMPOOL_STDOUT_LOG_MIN_PRIORITY: ""
diff --git a/docker/backend/mempool-config.json b/docker/backend/mempool-config.json
index 17901acc4..904370f3e 100644
--- a/docker/backend/mempool-config.json
+++ b/docker/backend/mempool-config.json
@@ -13,7 +13,6 @@
"BLOCK_WEIGHT_UNITS": __MEMPOOL_BLOCK_WEIGHT_UNITS__,
"INITIAL_BLOCKS_AMOUNT": __MEMPOOL_INITIAL_BLOCKS_AMOUNT__,
"MEMPOOL_BLOCKS_AMOUNT": __MEMPOOL_MEMPOOL_BLOCKS_AMOUNT__,
- "PRICE_FEED_UPDATE_INTERVAL": __MEMPOOL_PRICE_FEED_UPDATE_INTERVAL__,
"USE_SECOND_NODE_FOR_MINFEE": __MEMPOOL_USE_SECOND_NODE_FOR_MINFEE__,
"EXTERNAL_ASSETS": __MEMPOOL_EXTERNAL_ASSETS__,
"EXTERNAL_MAX_RETRY": __MEMPOOL_EXTERNAL_MAX_RETRY__,
diff --git a/docker/backend/start.sh b/docker/backend/start.sh
index e02706bce..58b19898a 100755
--- a/docker/backend/start.sh
+++ b/docker/backend/start.sh
@@ -16,7 +16,6 @@ __MEMPOOL_INITIAL_BLOCKS_AMOUNT__=${MEMPOOL_INITIAL_BLOCKS_AMOUNT:=8}
__MEMPOOL_MEMPOOL_BLOCKS_AMOUNT__=${MEMPOOL_MEMPOOL_BLOCKS_AMOUNT:=8}
__MEMPOOL_INDEXING_BLOCKS_AMOUNT__=${MEMPOOL_INDEXING_BLOCKS_AMOUNT:=11000}
__MEMPOOL_BLOCKS_SUMMARIES_INDEXING__=${MEMPOOL_BLOCKS_SUMMARIES_INDEXING:=false}
-__MEMPOOL_PRICE_FEED_UPDATE_INTERVAL__=${MEMPOOL_PRICE_FEED_UPDATE_INTERVAL:=600}
__MEMPOOL_USE_SECOND_NODE_FOR_MINFEE__=${MEMPOOL_USE_SECOND_NODE_FOR_MINFEE:=false}
__MEMPOOL_EXTERNAL_ASSETS__=${MEMPOOL_EXTERNAL_ASSETS:=[]}
__MEMPOOL_EXTERNAL_MAX_RETRY__=${MEMPOOL_EXTERNAL_MAX_RETRY:=1}
@@ -129,7 +128,6 @@ sed -i "s/__MEMPOOL_INITIAL_BLOCKS_AMOUNT__/${__MEMPOOL_INITIAL_BLOCKS_AMOUNT__}
sed -i "s/__MEMPOOL_MEMPOOL_BLOCKS_AMOUNT__/${__MEMPOOL_MEMPOOL_BLOCKS_AMOUNT__}/g" mempool-config.json
sed -i "s/__MEMPOOL_INDEXING_BLOCKS_AMOUNT__/${__MEMPOOL_INDEXING_BLOCKS_AMOUNT__}/g" mempool-config.json
sed -i "s/__MEMPOOL_BLOCKS_SUMMARIES_INDEXING__/${__MEMPOOL_BLOCKS_SUMMARIES_INDEXING__}/g" mempool-config.json
-sed -i "s/__MEMPOOL_PRICE_FEED_UPDATE_INTERVAL__/${__MEMPOOL_PRICE_FEED_UPDATE_INTERVAL__}/g" mempool-config.json
sed -i "s/__MEMPOOL_USE_SECOND_NODE_FOR_MINFEE__/${__MEMPOOL_USE_SECOND_NODE_FOR_MINFEE__}/g" mempool-config.json
sed -i "s!__MEMPOOL_EXTERNAL_ASSETS__!${__MEMPOOL_EXTERNAL_ASSETS__}!g" mempool-config.json
sed -i "s!__MEMPOOL_EXTERNAL_MAX_RETRY__!${__MEMPOOL_EXTERNAL_MAX_RETRY__}!g" mempool-config.json
From 9b793b8a6b6ee874393fa1360cac865b85484a6a Mon Sep 17 00:00:00 2001
From: Antoni Spaanderman <56turtle56@gmail.com>
Date: Thu, 16 Feb 2023 15:39:09 +0100
Subject: [PATCH 07/15] add size per weight graph and ts type for
`getHistoricalBlockSizesAndWeights`
---
.../block-sizes-weights-graph.component.ts | 25 +++++++++++++++++++
.../src/app/interfaces/node-api.interface.ts | 13 ++++++++++
frontend/src/app/services/api.service.ts | 8 +++---
3 files changed, 42 insertions(+), 4 deletions(-)
diff --git a/frontend/src/app/components/block-sizes-weights-graph/block-sizes-weights-graph.component.ts b/frontend/src/app/components/block-sizes-weights-graph/block-sizes-weights-graph.component.ts
index bc3c642db..7ad147b28 100644
--- a/frontend/src/app/components/block-sizes-weights-graph/block-sizes-weights-graph.component.ts
+++ b/frontend/src/app/components/block-sizes-weights-graph/block-sizes-weights-graph.component.ts
@@ -90,6 +90,7 @@ export class BlockSizesWeightsGraphComponent implements OnInit {
this.prepareChartOptions({
sizes: data.sizes.map(val => [val.timestamp * 1000, val.avgSize / 1000000, val.avgHeight]),
weights: data.weights.map(val => [val.timestamp * 1000, val.avgWeight / 1000000, val.avgHeight]),
+ sizePerWeight: data.weights.map((val, i) => [val.timestamp * 1000, data.sizes[i].avgSize / (val.avgWeight / 4), val.avgHeight]),
});
this.isLoading = false;
}),
@@ -124,6 +125,7 @@ export class BlockSizesWeightsGraphComponent implements OnInit {
color: [
'#FDD835',
'#D81B60',
+ '#14EDF5',
],
grid: {
top: 30,
@@ -153,6 +155,8 @@ export class BlockSizesWeightsGraphComponent implements OnInit {
tooltip += `${tick.marker} ${tick.seriesName}: ${formatNumber(tick.data[1], this.locale, '1.2-2')} MB`;
} else if (tick.seriesIndex === 1) { // Weight
tooltip += `${tick.marker} ${tick.seriesName}: ${formatNumber(tick.data[1], this.locale, '1.2-2')} MWU`;
+ } else if (tick.seriesIndex === 2) { // Size per weight
+ tooltip += `${tick.marker} ${tick.seriesName}: ${formatNumber(tick.data[1], this.locale, '1.2-2')} B/vB`;
}
tooltip += `
`;
}
@@ -192,10 +196,19 @@ export class BlockSizesWeightsGraphComponent implements OnInit {
},
icon: 'roundRect',
},
+ {
+ name: $localize`Size per weight`,
+ inactiveColor: 'rgb(110, 112, 121)',
+ textStyle: {
+ color: 'white',
+ },
+ icon: 'roundRect',
+ },
],
selected: JSON.parse(this.storageService.getValue('sizes_weights_legend')) ?? {
'Size': true,
'Weight': true,
+ 'Size per weight': true,
}
},
yAxis: data.sizes.length === 0 ? undefined : [
@@ -262,6 +275,18 @@ export class BlockSizesWeightsGraphComponent implements OnInit {
lineStyle: {
width: 2,
}
+ },
+ {
+ zlevel: 1,
+ yAxisIndex: 0,
+ name: $localize`Size per weight`,
+ showSymbol: false,
+ symbol: 'none',
+ data: data.sizePerWeight,
+ type: 'line',
+ lineStyle: {
+ width: 2,
+ }
}
],
dataZoom: [{
diff --git a/frontend/src/app/interfaces/node-api.interface.ts b/frontend/src/app/interfaces/node-api.interface.ts
index c35eb8098..c11cb5828 100644
--- a/frontend/src/app/interfaces/node-api.interface.ts
+++ b/frontend/src/app/interfaces/node-api.interface.ts
@@ -151,6 +151,19 @@ export interface RewardStats {
totalTx: number;
}
+export interface BlockSizesAndWeights {
+ sizes: {
+ timestamp: number;
+ avgHeight: number;
+ avgSize: number;
+ }[];
+ weights: {
+ timestamp: number;
+ avgHeight: number;
+ avgWeight: number;
+ }[];
+}
+
export interface AuditScore {
hash: string;
matchRate?: number;
diff --git a/frontend/src/app/services/api.service.ts b/frontend/src/app/services/api.service.ts
index 6eff41f61..04b2b72e2 100644
--- a/frontend/src/app/services/api.service.ts
+++ b/frontend/src/app/services/api.service.ts
@@ -1,7 +1,7 @@
import { Injectable } from '@angular/core';
-import { HttpClient, HttpParams } from '@angular/common/http';
+import { HttpClient, HttpParams, HttpResponse } from '@angular/common/http';
import { CpfpInfo, OptimizedMempoolStats, AddressInformation, LiquidPegs, ITranslators,
- PoolStat, BlockExtended, TransactionStripped, RewardStats, AuditScore } from '../interfaces/node-api.interface';
+ PoolStat, BlockExtended, TransactionStripped, RewardStats, AuditScore, BlockSizesAndWeights } from '../interfaces/node-api.interface';
import { Observable } from 'rxjs';
import { StateService } from './state.service';
import { WebsocketResponse } from '../interfaces/websocket.interface';
@@ -222,8 +222,8 @@ export class ApiService {
);
}
- getHistoricalBlockSizesAndWeights$(interval: string | undefined) : Observable {
- return this.httpClient.get(
+ getHistoricalBlockSizesAndWeights$(interval: string | undefined) : Observable> {
+ return this.httpClient.get(
this.apiBaseUrl + this.apiBasePath + `/api/v1/mining/blocks/sizes-weights` +
(interval !== undefined ? `/${interval}` : ''), { observe: 'response' }
);
From 0402523c8ec8fcc07e19f5d7205da9d9538db651 Mon Sep 17 00:00:00 2001
From: Antoni Spaanderman <49868160+antonilol@users.noreply.github.com>
Date: Fri, 17 Feb 2023 15:45:15 +0100
Subject: [PATCH 08/15] Update
frontend/src/app/components/block-sizes-weights-graph/block-sizes-weights-graph.component.ts
change size per weight graph color
Co-authored-by: nymkappa <9780671+nymkappa@users.noreply.github.com>
---
.../block-sizes-weights-graph.component.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/frontend/src/app/components/block-sizes-weights-graph/block-sizes-weights-graph.component.ts b/frontend/src/app/components/block-sizes-weights-graph/block-sizes-weights-graph.component.ts
index 7ad147b28..016dd79f6 100644
--- a/frontend/src/app/components/block-sizes-weights-graph/block-sizes-weights-graph.component.ts
+++ b/frontend/src/app/components/block-sizes-weights-graph/block-sizes-weights-graph.component.ts
@@ -125,7 +125,7 @@ export class BlockSizesWeightsGraphComponent implements OnInit {
color: [
'#FDD835',
'#D81B60',
- '#14EDF5',
+ '#039BE5,
],
grid: {
top: 30,
From 1d31f816496959c36cdb204a305dba52e37103a7 Mon Sep 17 00:00:00 2001
From: Antoni Spaanderman <56turtle56@gmail.com>
Date: Fri, 17 Feb 2023 15:47:32 +0100
Subject: [PATCH 09/15] fix missing quote
---
.../block-sizes-weights-graph.component.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/frontend/src/app/components/block-sizes-weights-graph/block-sizes-weights-graph.component.ts b/frontend/src/app/components/block-sizes-weights-graph/block-sizes-weights-graph.component.ts
index 016dd79f6..8477af588 100644
--- a/frontend/src/app/components/block-sizes-weights-graph/block-sizes-weights-graph.component.ts
+++ b/frontend/src/app/components/block-sizes-weights-graph/block-sizes-weights-graph.component.ts
@@ -125,7 +125,7 @@ export class BlockSizesWeightsGraphComponent implements OnInit {
color: [
'#FDD835',
'#D81B60',
- '#039BE5,
+ '#039BE5',
],
grid: {
top: 30,
From b8956cb0d897836f4122fc1a99183ebbfee7d56d Mon Sep 17 00:00:00 2001
From: Mononaut
Date: Tue, 7 Feb 2023 20:56:33 -0600
Subject: [PATCH 10/15] Reuse HTTP connections to esplora backend
---
backend/src/api/bitcoin/esplora-api.ts | 29 +++++++++++++++-----------
backend/src/index.ts | 7 +++++--
2 files changed, 22 insertions(+), 14 deletions(-)
diff --git a/backend/src/api/bitcoin/esplora-api.ts b/backend/src/api/bitcoin/esplora-api.ts
index 37f6e5892..0366695d1 100644
--- a/backend/src/api/bitcoin/esplora-api.ts
+++ b/backend/src/api/bitcoin/esplora-api.ts
@@ -1,8 +1,13 @@
import config from '../../config';
import axios, { AxiosRequestConfig } from 'axios';
+import http from 'http';
import { AbstractBitcoinApi } from './bitcoin-api-abstract-factory';
import { IEsploraApi } from './esplora-api.interface';
+const axiosConnection = axios.create({
+ httpAgent: new http.Agent({ keepAlive: true })
+});
+
class ElectrsApi implements AbstractBitcoinApi {
axiosConfig: AxiosRequestConfig = {
timeout: 10000,
@@ -11,52 +16,52 @@ class ElectrsApi implements AbstractBitcoinApi {
constructor() { }
$getRawMempool(): Promise {
- return axios.get(config.ESPLORA.REST_API_URL + '/mempool/txids', this.axiosConfig)
+ return axiosConnection.get(config.ESPLORA.REST_API_URL + '/mempool/txids', this.axiosConfig)
.then((response) => response.data);
}
$getRawTransaction(txId: string): Promise {
- return axios.get(config.ESPLORA.REST_API_URL + '/tx/' + txId, this.axiosConfig)
+ return axiosConnection.get(config.ESPLORA.REST_API_URL + '/tx/' + txId, this.axiosConfig)
.then((response) => response.data);
}
$getTransactionHex(txId: string): Promise {
- return axios.get(config.ESPLORA.REST_API_URL + '/tx/' + txId + '/hex', this.axiosConfig)
+ return axiosConnection.get(config.ESPLORA.REST_API_URL + '/tx/' + txId + '/hex', this.axiosConfig)
.then((response) => response.data);
}
$getBlockHeightTip(): Promise {
- return axios.get(config.ESPLORA.REST_API_URL + '/blocks/tip/height', this.axiosConfig)
+ return axiosConnection.get(config.ESPLORA.REST_API_URL + '/blocks/tip/height', this.axiosConfig)
.then((response) => response.data);
}
$getBlockHashTip(): Promise {
- return axios.get(config.ESPLORA.REST_API_URL + '/blocks/tip/hash', this.axiosConfig)
+ return axiosConnection.get(config.ESPLORA.REST_API_URL + '/blocks/tip/hash', this.axiosConfig)
.then((response) => response.data);
}
$getTxIdsForBlock(hash: string): Promise {
- return axios.get(config.ESPLORA.REST_API_URL + '/block/' + hash + '/txids', this.axiosConfig)
+ return axiosConnection.get(config.ESPLORA.REST_API_URL + '/block/' + hash + '/txids', this.axiosConfig)
.then((response) => response.data);
}
$getBlockHash(height: number): Promise {
- return axios.get(config.ESPLORA.REST_API_URL + '/block-height/' + height, this.axiosConfig)
+ return axiosConnection.get(config.ESPLORA.REST_API_URL + '/block-height/' + height, this.axiosConfig)
.then((response) => response.data);
}
$getBlockHeader(hash: string): Promise {
- return axios.get(config.ESPLORA.REST_API_URL + '/block/' + hash + '/header', this.axiosConfig)
+ return axiosConnection.get(config.ESPLORA.REST_API_URL + '/block/' + hash + '/header', this.axiosConfig)
.then((response) => response.data);
}
$getBlock(hash: string): Promise {
- return axios.get(config.ESPLORA.REST_API_URL + '/block/' + hash, this.axiosConfig)
+ return axiosConnection.get(config.ESPLORA.REST_API_URL + '/block/' + hash, this.axiosConfig)
.then((response) => response.data);
}
$getRawBlock(hash: string): Promise {
- return axios.get(config.ESPLORA.REST_API_URL + '/block/' + hash + "/raw", { ...this.axiosConfig, responseType: 'arraybuffer' })
+ return axiosConnection.get(config.ESPLORA.REST_API_URL + '/block/' + hash + "/raw", { ...this.axiosConfig, responseType: 'arraybuffer' })
.then((response) => { return Buffer.from(response.data); });
}
@@ -77,12 +82,12 @@ class ElectrsApi implements AbstractBitcoinApi {
}
$getOutspend(txId: string, vout: number): Promise {
- return axios.get(config.ESPLORA.REST_API_URL + '/tx/' + txId + '/outspend/' + vout, this.axiosConfig)
+ return axiosConnection.get(config.ESPLORA.REST_API_URL + '/tx/' + txId + '/outspend/' + vout, this.axiosConfig)
.then((response) => response.data);
}
$getOutspends(txId: string): Promise {
- return axios.get(config.ESPLORA.REST_API_URL + '/tx/' + txId + '/outspends', this.axiosConfig)
+ return axiosConnection.get(config.ESPLORA.REST_API_URL + '/tx/' + txId + '/outspends', this.axiosConfig)
.then((response) => response.data);
}
diff --git a/backend/src/index.ts b/backend/src/index.ts
index a81275066..919c039c3 100644
--- a/backend/src/index.ts
+++ b/backend/src/index.ts
@@ -36,6 +36,7 @@ import bitcoinRoutes from './api/bitcoin/bitcoin.routes';
import fundingTxFetcher from './tasks/lightning/sync-tasks/funding-tx-fetcher';
import forensicsService from './tasks/lightning/forensics.service';
import priceUpdater from './tasks/price-updater';
+import { AxiosError } from 'axios';
class Server {
private wss: WebSocket.Server | undefined;
@@ -178,7 +179,7 @@ class Server {
setTimeout(this.runMainUpdateLoop.bind(this), config.MEMPOOL.POLL_RATE_MS);
this.currentBackendRetryInterval = 5;
- } catch (e) {
+ } catch (e: any) {
const loggerMsg = `runMainLoop error: ${(e instanceof Error ? e.message : e)}. Retrying in ${this.currentBackendRetryInterval} sec.`;
if (this.currentBackendRetryInterval > 5) {
logger.warn(loggerMsg);
@@ -186,7 +187,9 @@ class Server {
} else {
logger.debug(loggerMsg);
}
- logger.debug(JSON.stringify(e));
+ if (e instanceof AxiosError) {
+ logger.debug(`AxiosError: ${e?.message}`);
+ }
setTimeout(this.runMainUpdateLoop.bind(this), 1000 * this.currentBackendRetryInterval);
this.currentBackendRetryInterval *= 2;
this.currentBackendRetryInterval = Math.min(this.currentBackendRetryInterval, 60);
From 9289307bbf86d0ecfee4537315630302ec1fe4c8 Mon Sep 17 00:00:00 2001
From: nymkappa <1612910616@pm.me>
Date: Sun, 19 Feb 2023 17:14:49 +0900
Subject: [PATCH 11/15] Remove hardcoded mining pools colors as it's not
relevant
---
frontend/src/app/app.constants.ts | 18 +++---------------
.../pool-ranking/pool-ranking.component.ts | 2 +-
2 files changed, 4 insertions(+), 16 deletions(-)
diff --git a/frontend/src/app/app.constants.ts b/frontend/src/app/app.constants.ts
index 5cc446dbf..8a954166e 100644
--- a/frontend/src/app/app.constants.ts
+++ b/frontend/src/app/app.constants.ts
@@ -72,22 +72,10 @@ export const chartColors = [
];
export const poolsColor = {
- 'foundryusa': '#D81B60',
- 'antpool': '#8E24AA',
- 'f2pool': '#5E35B1',
- 'poolin': '#3949AB',
- 'binancepool': '#1E88E5',
- 'viabtc': '#039BE5',
- 'btccom': '#00897B',
- 'braiinspool': '#00ACC1',
- 'sbicrypto': '#43A047',
- 'marapool': '#7CB342',
- 'luxor': '#C0CA33',
- 'unknown': '#FDD835',
- 'okkong': '#FFB300',
-}
+ 'unknown': '#9C9C9C',
+};
- export const feeLevels = [1, 2, 3, 4, 5, 6, 8, 10, 12, 15, 20, 30, 40, 50, 60, 70, 80, 90, 100, 125, 150, 175, 200,
+export const feeLevels = [1, 2, 3, 4, 5, 6, 8, 10, 12, 15, 20, 30, 40, 50, 60, 70, 80, 90, 100, 125, 150, 175, 200,
250, 300, 350, 400, 500, 600, 700, 800, 900, 1000, 1200, 1400, 1600, 1800, 2000];
export interface Language {
diff --git a/frontend/src/app/components/pool-ranking/pool-ranking.component.ts b/frontend/src/app/components/pool-ranking/pool-ranking.component.ts
index 3460470ce..214318bd5 100644
--- a/frontend/src/app/components/pool-ranking/pool-ranking.component.ts
+++ b/frontend/src/app/components/pool-ranking/pool-ranking.component.ts
@@ -176,7 +176,7 @@ export class PoolRankingComponent implements OnInit {
// 'Other'
data.push({
itemStyle: {
- color: 'grey',
+ color: '#6b6b6b',
},
value: totalShareOther,
name: 'Other' + (isMobile() ? `` : ` (${totalShareOther.toFixed(2)}%)`),
From cf9165d82ef667aa532833fa4147514fb8f9e865 Mon Sep 17 00:00:00 2001
From: nymkappa <1612910616@pm.me>
Date: Sun, 19 Feb 2023 17:36:09 +0900
Subject: [PATCH 12/15] Fixes #3034
---
.../src/app/components/blocks-list/blocks-list.component.html | 4 ++--
.../lightning-dashboard/lightning-dashboard.component.html | 1 -
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/frontend/src/app/components/blocks-list/blocks-list.component.html b/frontend/src/app/components/blocks-list/blocks-list.component.html
index ffb5f5f88..71b6b2be2 100644
--- a/frontend/src/app/components/blocks-list/blocks-list.component.html
+++ b/frontend/src/app/components/blocks-list/blocks-list.component.html
@@ -123,8 +123,8 @@
(pageChange)="pageChange(page)" [boundaryLinks]="true" [ellipses]="false">
-
-
+
+
diff --git a/frontend/src/app/lightning/lightning-dashboard/lightning-dashboard.component.html b/frontend/src/app/lightning/lightning-dashboard/lightning-dashboard.component.html
index 030019b3c..cb9dc6ecb 100644
--- a/frontend/src/app/lightning/lightning-dashboard/lightning-dashboard.component.html
+++ b/frontend/src/app/lightning/lightning-dashboard/lightning-dashboard.component.html
@@ -102,7 +102,6 @@
Broadcast Transaction
-
From a1b7a33b91f19cdf1846fb6ab7c0fea6526a1a3c Mon Sep 17 00:00:00 2001
From: nymkappa <1612910616@pm.me>
Date: Sun, 19 Feb 2023 19:08:29 +0900
Subject: [PATCH 13/15] Fix database usage when database is disabled
---
backend/src/api/blocks.ts | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/backend/src/api/blocks.ts b/backend/src/api/blocks.ts
index 3f2a7b49e..d110186f5 100644
--- a/backend/src/api/blocks.ts
+++ b/backend/src/api/blocks.ts
@@ -600,9 +600,11 @@ class Blocks {
* Index a block if it's missing from the database. Returns the block after indexing
*/
public async $indexBlock(height: number): Promise {
- const dbBlock = await blocksRepository.$getBlockByHeight(height);
- if (dbBlock != null) {
- return prepareBlock(dbBlock);
+ if (Common.indexingEnabled()) {
+ const dbBlock = await blocksRepository.$getBlockByHeight(height);
+ if (dbBlock !== null) {
+ return prepareBlock(dbBlock);
+ }
}
const blockHash = await bitcoinApi.$getBlockHash(height);
From b4ee760ca585f5c515766b6ab6e3a4681a7564cd Mon Sep 17 00:00:00 2001
From: nymkappa <1612910616@pm.me>
Date: Sun, 19 Feb 2023 19:30:55 +0900
Subject: [PATCH 14/15] Wrap duplicate ngIf into a ng-template
---
.../app/components/blocks-list/blocks-list.component.html | 6 ++++--
.../lightning-dashboard/lightning-dashboard.component.html | 4 ++--
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/frontend/src/app/components/blocks-list/blocks-list.component.html b/frontend/src/app/components/blocks-list/blocks-list.component.html
index 71b6b2be2..83478c69b 100644
--- a/frontend/src/app/components/blocks-list/blocks-list.component.html
+++ b/frontend/src/app/components/blocks-list/blocks-list.component.html
@@ -123,8 +123,10 @@
(pageChange)="pageChange(page)" [boundaryLinks]="true" [ellipses]="false">
-
-
+
+
+
+
diff --git a/frontend/src/app/lightning/lightning-dashboard/lightning-dashboard.component.html b/frontend/src/app/lightning/lightning-dashboard/lightning-dashboard.component.html
index cb9dc6ecb..c12565d6d 100644
--- a/frontend/src/app/lightning/lightning-dashboard/lightning-dashboard.component.html
+++ b/frontend/src/app/lightning/lightning-dashboard/lightning-dashboard.component.html
@@ -102,6 +102,6 @@
Broadcast Transaction
-
+
-
+
\ No newline at end of file
From dbc440299980cb2cbb5e0d7981d4c89852b22f95 Mon Sep 17 00:00:00 2001
From: nymkappa <9780671+nymkappa@users.noreply.github.com>
Date: Sun, 19 Feb 2023 20:43:51 +0900
Subject: [PATCH 15/15] Update blocks-list.component.html
---
.../src/app/components/blocks-list/blocks-list.component.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/frontend/src/app/components/blocks-list/blocks-list.component.html b/frontend/src/app/components/blocks-list/blocks-list.component.html
index 83478c69b..22c7e2e9d 100644
--- a/frontend/src/app/components/blocks-list/blocks-list.component.html
+++ b/frontend/src/app/components/blocks-list/blocks-list.component.html
@@ -125,7 +125,7 @@
-
+