@@ -217,12 +217,8 @@ export class BlockComponent implements OnInit, OnDestroy {
|
||||
this.blockSubsidy = 0;
|
||||
return;
|
||||
}
|
||||
this.blockSubsidy = 50;
|
||||
let halvenings = Math.floor(this.block.height / 210000);
|
||||
while (halvenings > 0) {
|
||||
this.blockSubsidy = this.blockSubsidy / 2;
|
||||
halvenings--;
|
||||
}
|
||||
const halvings = Math.floor(this.block.height / 210000);
|
||||
this.blockSubsidy = 50 * 2 ** -halvings;
|
||||
}
|
||||
|
||||
pageChange(page: number, target: HTMLElement) {
|
||||
|
||||
@@ -110,7 +110,7 @@ export class BlockchainBlocksComponent implements OnInit, OnDestroy {
|
||||
this.markBlockSubscription = this.stateService.markBlock$
|
||||
.subscribe((state) => {
|
||||
this.markHeight = undefined;
|
||||
if (state.blockHeight) {
|
||||
if (state.blockHeight !== undefined) {
|
||||
this.markHeight = state.blockHeight;
|
||||
}
|
||||
this.moveArrowToPosition(false);
|
||||
@@ -127,7 +127,7 @@ export class BlockchainBlocksComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
moveArrowToPosition(animate: boolean, newBlockFromLeft = false) {
|
||||
if (!this.markHeight) {
|
||||
if (this.markHeight === undefined) {
|
||||
this.arrowVisible = false;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -109,8 +109,12 @@ export class LatestBlocksComponent implements OnInit, OnDestroy {
|
||||
if (this.isLoading) {
|
||||
return;
|
||||
}
|
||||
const height = this.blocks[this.blocks.length - 1].height - 1;
|
||||
if (height < 0) {
|
||||
return;
|
||||
}
|
||||
this.isLoading = true;
|
||||
this.electrsApiService.listBlocks$(this.blocks[this.blocks.length - 1].height - 1)
|
||||
this.electrsApiService.listBlocks$(height)
|
||||
.subscribe((blocks) => {
|
||||
this.blocks = this.blocks.concat(blocks);
|
||||
this.isLoading = false;
|
||||
|
||||
@@ -144,6 +144,9 @@ export class DashboardComponent implements OnInit {
|
||||
this.latestBlockHeight = block.height;
|
||||
}),
|
||||
scan((acc, [block]) => {
|
||||
if (acc.find((b) => b.height == block.height)) {
|
||||
return acc;
|
||||
}
|
||||
acc.unshift(block);
|
||||
acc = acc.slice(0, 6);
|
||||
return acc;
|
||||
@@ -153,6 +156,9 @@ export class DashboardComponent implements OnInit {
|
||||
this.transactions$ = this.stateService.transactions$
|
||||
.pipe(
|
||||
scan((acc, tx) => {
|
||||
if (acc.find((t) => t.txid == tx.txid)) {
|
||||
return acc;
|
||||
}
|
||||
acc.unshift(tx);
|
||||
acc = acc.slice(0, 6);
|
||||
return acc;
|
||||
|
||||
@@ -71,7 +71,7 @@ export class StateService {
|
||||
network = '';
|
||||
blockVSize: number;
|
||||
env: Env;
|
||||
latestBlockHeight = 0;
|
||||
latestBlockHeight = -1;
|
||||
|
||||
networkChanged$ = new ReplaySubject<string>(1);
|
||||
blocks$: ReplaySubject<[BlockExtended, boolean]>;
|
||||
|
||||
@@ -68,7 +68,7 @@ export class WebsocketService {
|
||||
clearTimeout(this.onlineCheckTimeout);
|
||||
clearTimeout(this.onlineCheckTimeoutTwo);
|
||||
|
||||
this.stateService.latestBlockHeight = 0;
|
||||
this.stateService.latestBlockHeight = -1;
|
||||
|
||||
this.websocketSubject.complete();
|
||||
this.subscription.unsubscribe();
|
||||
|
||||
Reference in New Issue
Block a user