diff --git a/frontend/src/app/components/stratum/stratum-list/stratum-list.component.html b/frontend/src/app/components/stratum/stratum-list/stratum-list.component.html index 6132035be..08d7fb0ef 100644 --- a/frontend/src/app/components/stratum/stratum-list/stratum-list.component.html +++ b/frontend/src/app/components/stratum/stratum-list/stratum-list.component.html @@ -9,6 +9,7 @@ Height Reward + Coinbase Tag Merkle Branches @@ -24,6 +25,9 @@ + + {{ row.job.tag }} + @for (cell of row.merkleCells; track $index) {
diff --git a/frontend/src/app/components/stratum/stratum-list/stratum-list.component.scss b/frontend/src/app/components/stratum/stratum-list/stratum-list.component.scss index da0e63967..6679f2257 100644 --- a/frontend/src/app/components/stratum/stratum-list/stratum-list.component.scss +++ b/frontend/src/app/components/stratum/stratum-list/stratum-list.component.scss @@ -6,9 +6,16 @@ td { position: relative; height: 2em; - &.height, &.reward { + &.height, &.reward, &.tag { padding: 0 5px; } + + &.tag { + max-width: 180px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } &.pool { padding-left: 5px; diff --git a/frontend/src/app/components/stratum/stratum-list/stratum-list.component.ts b/frontend/src/app/components/stratum/stratum-list/stratum-list.component.ts index af34fd091..1ab1a1c94 100644 --- a/frontend/src/app/components/stratum/stratum-list/stratum-list.component.ts +++ b/frontend/src/app/components/stratum/stratum-list/stratum-list.component.ts @@ -8,10 +8,14 @@ import { SinglePoolStats } from '../../../interfaces/node-api.interface'; type MerkleCellType = ' ' | '┬' | '├' | '└' | '│' | '─' | 'leaf'; +interface TaggedStratumJob extends StratumJob { + tag: string; +} + interface MerkleCell { hash: string; type: MerkleCellType; - job?: StratumJob; + job?: TaggedStratumJob; } interface MerkleTree { @@ -22,10 +26,25 @@ interface MerkleTree { } interface PoolRow { - job: StratumJob; + job: TaggedStratumJob; merkleCells: MerkleCell[]; } +function parseTag(scriptSig: string): string { + const hex = scriptSig.slice(8).replace(/6d6d.{64}/, ''); + const bytes: number[] = []; + for (let i = 0; i < hex.length; i += 2) { + bytes.push(parseInt(hex.substr(i, 2), 16)); + } + const ascii = new TextDecoder('utf8').decode(Uint8Array.from(bytes)).replace(/\uFFFD/g, '').replace(/\\0/g, ''); + if (ascii.includes('/ViaBTC/')) { + return '/ViaBTC/'; + } else if (ascii.includes('SpiderPool/')) { + return 'SpiderPool/'; + } + return ascii.match(/\/.*\//)?.[0] || ascii; +} + @Component({ selector: 'app-stratum-list', templateUrl: './stratum-list.component.html', @@ -60,7 +79,11 @@ export class StratumList implements OnInit, OnDestroy { this.websocketService.startTrackStratum('all'); } - processJobs(jobs: Record): PoolRow[] { + processJobs(rawJobs: Record): PoolRow[] { + const jobs: Record = {}; + for (const [id, job] of Object.entries(rawJobs)) { + jobs[id] = { ...job, tag: parseTag(job.scriptsig) }; + } if (Object.keys(jobs).length === 0) { return []; }