From 9f15e9a1d76a9a88f622a0890ac8e9e9a8e93415 Mon Sep 17 00:00:00 2001 From: Mononaut Date: Wed, 1 Feb 2023 11:52:00 -0600 Subject: [PATCH 1/5] Fix blockchain scroll jumping on resize on mobile --- frontend/src/app/components/start/start.component.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/frontend/src/app/components/start/start.component.ts b/frontend/src/app/components/start/start.component.ts index d29372d97..20492669d 100644 --- a/frontend/src/app/components/start/start.component.ts +++ b/frontend/src/app/components/start/start.component.ts @@ -123,7 +123,7 @@ export class StartComponent implements OnInit, OnDestroy { this.minScrollWidth = this.firstPageWidth + (this.pageWidth * 2); if (firstVisibleBlock != null) { - this.scrollToBlock(firstVisibleBlock, offset); + this.scrollToBlock(firstVisibleBlock, offset + (this.isMobile ? this.blockWidth : 0)); } else { this.updatePages(); } @@ -178,8 +178,10 @@ export class StartComponent implements OnInit, OnDestroy { setTimeout(() => { this.scrollToBlock(height, blockOffset); }, 50); return; } - const targetHeight = this.isMobile ? height - 1 : height; - const viewingPageIndex = this.getPageIndexOf(targetHeight); + if (this.isMobile) { + blockOffset -= this.blockWidth; + } + const viewingPageIndex = this.getPageIndexOf(height); const pages = []; this.pageIndex = Math.max(viewingPageIndex - 1, 0); let viewingPage = this.getPageAt(viewingPageIndex); @@ -189,7 +191,7 @@ export class StartComponent implements OnInit, OnDestroy { viewingPage = this.getPageAt(viewingPageIndex); } const left = viewingPage.offset - this.getConvertedScrollOffset(); - const blockIndex = viewingPage.height - targetHeight; + const blockIndex = viewingPage.height - height; const targetOffset = (this.blockWidth * blockIndex) + left; let deltaOffset = targetOffset - blockOffset; From 77686821bae49f31a483facddc36eea40049927a Mon Sep 17 00:00:00 2001 From: Mononaut Date: Fri, 17 Feb 2023 10:12:33 -0600 Subject: [PATCH 2/5] Raise production memory limits Increases maxmempool production bitcoin.conf setting to 2GB, and raises `npm run start-production` nodejs memory limit to 8GB --- backend/package.json | 2 +- production/bitcoin.conf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/package.json b/backend/package.json index da72386fe..9c1b3a12a 100644 --- a/backend/package.json +++ b/backend/package.json @@ -27,7 +27,7 @@ "package": "npm run build && rm -rf package && mv dist package && mv node_modules package && npm run package-rm-build-deps", "package-rm-build-deps": "(cd package/node_modules; rm -r typescript @typescript-eslint)", "start": "node --max-old-space-size=2048 dist/index.js", - "start-production": "node --max-old-space-size=4096 dist/index.js", + "start-production": "node --max-old-space-size=16384 dist/index.js", "test": "./node_modules/.bin/jest --coverage", "lint": "./node_modules/.bin/eslint . --ext .ts", "lint:fix": "./node_modules/.bin/eslint . --ext .ts --fix", diff --git a/production/bitcoin.conf b/production/bitcoin.conf index 99fbaeed1..46ab41b20 100644 --- a/production/bitcoin.conf +++ b/production/bitcoin.conf @@ -5,7 +5,7 @@ listen=1 discover=1 par=16 dbcache=8192 -maxmempool=1337 +maxmempool=4096 mempoolexpiry=999999 maxconnections=42 onion=127.0.0.1:9050 From e8d54f254bfea23d0586f9bd9bc077a23f321f68 Mon Sep 17 00:00:00 2001 From: Mononaut Date: Tue, 21 Feb 2023 21:59:31 -0600 Subject: [PATCH 3/5] pixel-perfect flow diagrams --- .../tx-bowtie-graph/tx-bowtie-graph.component.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/frontend/src/app/components/tx-bowtie-graph/tx-bowtie-graph.component.ts b/frontend/src/app/components/tx-bowtie-graph/tx-bowtie-graph.component.ts index 49d97dd40..cd1fc6855 100644 --- a/frontend/src/app/components/tx-bowtie-graph/tx-bowtie-graph.component.ts +++ b/frontend/src/app/components/tx-bowtie-graph/tx-bowtie-graph.component.ts @@ -196,8 +196,8 @@ export class TxBowtieGraphComponent implements OnInit, OnChanges { this.outputs = this.initLines('out', voutWithFee, totalValue, this.maxStrands); this.middle = { - path: `M ${(this.width / 2) - this.midWidth} ${(this.height / 2) + 0.5} L ${(this.width / 2) + this.midWidth} ${(this.height / 2) + 0.5}`, - style: `stroke-width: ${this.combinedWeight + 1}; stroke: ${this.gradient[1]}` + path: `M ${(this.width / 2) - this.midWidth} ${(this.height / 2) + 0.25} L ${(this.width / 2) + this.midWidth} ${(this.height / 2) + 0.25}`, + style: `stroke-width: ${this.combinedWeight + 0.5}; stroke: ${this.gradient[1]}` }; this.hasLine = this.inputs.reduce((line, put) => line || !put.zeroValue, false) @@ -254,7 +254,7 @@ export class TxBowtieGraphComponent implements OnInit, OnChanges { const lineParams = weights.map((w, i) => { return { weight: w, - thickness: xputs[i].value === 0 ? this.zeroValueThickness : Math.max(this.minWeight - 1, w) + 1, + thickness: xputs[i].value === 0 ? this.zeroValueThickness : Math.min(this.combinedWeight + 0.5, Math.max(this.minWeight - 1, w) + 1), offset: 0, innerY: 0, outerY: 0, @@ -266,7 +266,7 @@ export class TxBowtieGraphComponent implements OnInit, OnChanges { // bounds of the middle segment const innerTop = (this.height / 2) - (this.combinedWeight / 2); - const innerBottom = innerTop + this.combinedWeight; + const innerBottom = innerTop + this.combinedWeight + 0.5; // tracks the visual bottom of the endpoints of the previous line let lastOuter = 0; let lastInner = innerTop; @@ -291,7 +291,7 @@ export class TxBowtieGraphComponent implements OnInit, OnChanges { // set the vertical position of the (center of the) outer side of the line line.outerY = lastOuter + (line.thickness / 2); - line.innerY = Math.min(innerBottom + (line.thickness / 2), Math.max(innerTop + (line.thickness / 2), lastInner + (line.weight / 2))); + line.innerY = Math.min(innerBottom - (line.thickness / 2), Math.max(innerTop + (line.thickness / 2), lastInner + (line.weight / 2))); // special case to center single input/outputs if (xputs.length === 1) { From ee54e782f8c99faab9cae476241a172c2d41394a Mon Sep 17 00:00:00 2001 From: nymkappa <1612910616@pm.me> Date: Thu, 23 Feb 2023 15:06:57 +0900 Subject: [PATCH 4/5] Only display reward and block fee charts in USD due to missing historical data --- backend/src/repositories/BlocksRepository.ts | 4 ++-- .../block-fees-graph.component.ts | 15 ++------------- .../block-rewards-graph.component.ts | 16 +++------------- 3 files changed, 7 insertions(+), 28 deletions(-) diff --git a/backend/src/repositories/BlocksRepository.ts b/backend/src/repositories/BlocksRepository.ts index 355187e21..df98719b9 100644 --- a/backend/src/repositories/BlocksRepository.ts +++ b/backend/src/repositories/BlocksRepository.ts @@ -521,7 +521,7 @@ class BlocksRepository { CAST(AVG(blocks.height) as INT) as avgHeight, CAST(AVG(UNIX_TIMESTAMP(blockTimestamp)) as INT) as timestamp, CAST(AVG(fees) as INT) as avgFees, - prices.* + prices.USD FROM blocks JOIN blocks_prices on blocks_prices.height = blocks.height JOIN prices on prices.id = blocks_prices.price_id @@ -550,7 +550,7 @@ class BlocksRepository { CAST(AVG(blocks.height) as INT) as avgHeight, CAST(AVG(UNIX_TIMESTAMP(blockTimestamp)) as INT) as timestamp, CAST(AVG(reward) as INT) as avgRewards, - prices.* + prices.USD FROM blocks JOIN blocks_prices on blocks_prices.height = blocks.height JOIN prices on prices.id = blocks_prices.price_id diff --git a/frontend/src/app/components/block-fees-graph/block-fees-graph.component.ts b/frontend/src/app/components/block-fees-graph/block-fees-graph.component.ts index 96bd0697c..051d24848 100644 --- a/frontend/src/app/components/block-fees-graph/block-fees-graph.component.ts +++ b/frontend/src/app/components/block-fees-graph/block-fees-graph.component.ts @@ -1,19 +1,17 @@ import { ChangeDetectionStrategy, Component, Inject, Input, LOCALE_ID, OnInit } from '@angular/core'; import { EChartsOption, graphic } from 'echarts'; -import { Observable, Subscription } from 'rxjs'; +import { Observable } from 'rxjs'; import { map, share, startWith, switchMap, tap } from 'rxjs/operators'; import { ApiService } from '../../services/api.service'; import { SeoService } from '../../services/seo.service'; import { formatNumber } from '@angular/common'; import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms'; import { download, formatterXAxis } from '../../shared/graphs.utils'; -import { StateService } from '../../services/state.service'; import { StorageService } from '../../services/storage.service'; import { MiningService } from '../../services/mining.service'; import { ActivatedRoute } from '@angular/router'; import { FiatShortenerPipe } from '../../shared/pipes/fiat-shortener.pipe'; import { FiatCurrencyPipe } from '../../shared/pipes/fiat-currency.pipe'; -import { fiatCurrencies } from '../../app.constants'; @Component({ selector: 'app-block-fees-graph', @@ -47,7 +45,6 @@ export class BlockFeesGraphComponent implements OnInit { timespan = ''; chartInstance: any = undefined; - currencySubscription: Subscription; currency: string; constructor( @@ -57,21 +54,13 @@ export class BlockFeesGraphComponent implements OnInit { private formBuilder: UntypedFormBuilder, private storageService: StorageService, private miningService: MiningService, - private stateService: StateService, private route: ActivatedRoute, private fiatShortenerPipe: FiatShortenerPipe, private fiatCurrencyPipe: FiatCurrencyPipe, ) { this.radioGroupForm = this.formBuilder.group({ dateSpan: '1y' }); this.radioGroupForm.controls.dateSpan.setValue('1y'); - - this.currencySubscription = this.stateService.fiatCurrency$.subscribe((fiat) => { - if (fiat && fiatCurrencies[fiat]?.indexed) { - this.currency = fiat; - } else { - this.currency = 'USD'; - } - }); + this.currency = 'USD'; } ngOnInit(): void { diff --git a/frontend/src/app/components/block-rewards-graph/block-rewards-graph.component.ts b/frontend/src/app/components/block-rewards-graph/block-rewards-graph.component.ts index ca1853633..2d8a6f858 100644 --- a/frontend/src/app/components/block-rewards-graph/block-rewards-graph.component.ts +++ b/frontend/src/app/components/block-rewards-graph/block-rewards-graph.component.ts @@ -1,19 +1,17 @@ import { ChangeDetectionStrategy, Component, Inject, Input, LOCALE_ID, OnInit } from '@angular/core'; import { EChartsOption, graphic } from 'echarts'; -import { Observable, Subscription } from 'rxjs'; +import { Observable } from 'rxjs'; import { map, share, startWith, switchMap, tap } from 'rxjs/operators'; import { ApiService } from '../../services/api.service'; import { SeoService } from '../../services/seo.service'; import { formatNumber } from '@angular/common'; import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms'; -import { download, formatterXAxis, formatterXAxisLabel, formatterXAxisTimeCategory } from '../../shared/graphs.utils'; +import { download, formatterXAxis } from '../../shared/graphs.utils'; import { MiningService } from '../../services/mining.service'; -import { StateService } from '../../services/state.service'; import { StorageService } from '../../services/storage.service'; import { ActivatedRoute } from '@angular/router'; import { FiatShortenerPipe } from '../../shared/pipes/fiat-shortener.pipe'; import { FiatCurrencyPipe } from '../../shared/pipes/fiat-currency.pipe'; -import { fiatCurrencies } from '../../app.constants'; @Component({ selector: 'app-block-rewards-graph', @@ -47,7 +45,6 @@ export class BlockRewardsGraphComponent implements OnInit { timespan = ''; chartInstance: any = undefined; - currencySubscription: Subscription; currency: string; constructor( @@ -56,19 +53,12 @@ export class BlockRewardsGraphComponent implements OnInit { private apiService: ApiService, private formBuilder: UntypedFormBuilder, private miningService: MiningService, - private stateService: StateService, private storageService: StorageService, private route: ActivatedRoute, private fiatShortenerPipe: FiatShortenerPipe, private fiatCurrencyPipe: FiatCurrencyPipe, ) { - this.currencySubscription = this.stateService.fiatCurrency$.subscribe((fiat) => { - if (fiat && fiatCurrencies[fiat]?.indexed) { - this.currency = fiat; - } else { - this.currency = 'USD'; - } - }); + this.currency = 'USD'; } ngOnInit(): void { From ffe02c250953a980b0df40e7f0cc96081e754390 Mon Sep 17 00:00:00 2001 From: nymkappa <1612910616@pm.me> Date: Thu, 23 Feb 2023 16:01:56 +0900 Subject: [PATCH 5/5] Fix lightning chart widget layout --- .../nodes-networks-chart/nodes-networks-chart.component.ts | 6 +++--- .../lightning-statistics-chart.component.ts | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/frontend/src/app/lightning/nodes-networks-chart/nodes-networks-chart.component.ts b/frontend/src/app/lightning/nodes-networks-chart/nodes-networks-chart.component.ts index 20ce5cc6f..0ff9f4af1 100644 --- a/frontend/src/app/lightning/nodes-networks-chart/nodes-networks-chart.component.ts +++ b/frontend/src/app/lightning/nodes-networks-chart/nodes-networks-chart.component.ts @@ -130,7 +130,7 @@ export class NodesNetworksChartComponent implements OnInit { }, text: $localize`:@@b420668a91f8ebaf6e6409c4ba87f1d45961d2bd:Lightning Nodes Per Network`, left: 'center', - top: 11, + top: 0, zlevel: 10, }; } @@ -227,8 +227,8 @@ export class NodesNetworksChartComponent implements OnInit { title: title, animation: false, grid: { - height: this.widget ? 100 : undefined, - top: this.widget ? 10 : 40, + height: this.widget ? 90 : undefined, + top: this.widget ? 20 : 40, bottom: this.widget ? 0 : 70, right: (isMobile() && this.widget) ? 35 : this.right, left: (isMobile() && this.widget) ? 40 :this.left, diff --git a/frontend/src/app/lightning/statistics-chart/lightning-statistics-chart.component.ts b/frontend/src/app/lightning/statistics-chart/lightning-statistics-chart.component.ts index 916483781..b93ee1f3d 100644 --- a/frontend/src/app/lightning/statistics-chart/lightning-statistics-chart.component.ts +++ b/frontend/src/app/lightning/statistics-chart/lightning-statistics-chart.component.ts @@ -121,7 +121,7 @@ export class LightningStatisticsChartComponent implements OnInit { }, text: $localize`:@@ea8db27e6db64f8b940711948c001a1100e5fe9f:Lightning Network Capacity`, left: 'center', - top: 11, + top: 0, zlevel: 10, }; } @@ -137,8 +137,8 @@ export class LightningStatisticsChartComponent implements OnInit { ]), ], grid: { - height: this.widget ? 100 : undefined, - top: this.widget ? 10 : 40, + height: this.widget ? 90 : undefined, + top: this.widget ? 20 : 40, bottom: this.widget ? 0 : 70, right: (isMobile() && this.widget) ? 35 : this.right, left: (isMobile() && this.widget) ? 40 :this.left,