add coinbase tag column to stratum table
This commit is contained in:
parent
cb4bf0611e
commit
9ba7172b5b
@ -9,6 +9,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td class="height">Height</td>
|
<td class="height">Height</td>
|
||||||
<td class="reward">Reward</td>
|
<td class="reward">Reward</td>
|
||||||
|
<td class="tag">Coinbase Tag</td>
|
||||||
<td class="merkle" [attr.colspan]="rows[0]?.merkleCells?.length || 4">
|
<td class="merkle" [attr.colspan]="rows[0]?.merkleCells?.length || 4">
|
||||||
Merkle Branches
|
Merkle Branches
|
||||||
</td>
|
</td>
|
||||||
@ -24,6 +25,9 @@
|
|||||||
<td class="reward">
|
<td class="reward">
|
||||||
<app-amount [satoshis]="row.job.reward"></app-amount>
|
<app-amount [satoshis]="row.job.reward"></app-amount>
|
||||||
</td>
|
</td>
|
||||||
|
<td class="tag">
|
||||||
|
{{ row.job.tag }}
|
||||||
|
</td>
|
||||||
@for (cell of row.merkleCells; track $index) {
|
@for (cell of row.merkleCells; track $index) {
|
||||||
<td class="merkle" [style.background-color]="cell.hash ? '#' + cell.hash.slice(0, 6) : ''">
|
<td class="merkle" [style.background-color]="cell.hash ? '#' + cell.hash.slice(0, 6) : ''">
|
||||||
<div class="pipe-segment" [class]="pipeToClass(cell.type)"></div>
|
<div class="pipe-segment" [class]="pipeToClass(cell.type)"></div>
|
||||||
|
@ -6,9 +6,16 @@ td {
|
|||||||
position: relative;
|
position: relative;
|
||||||
height: 2em;
|
height: 2em;
|
||||||
|
|
||||||
&.height, &.reward {
|
&.height, &.reward, &.tag {
|
||||||
padding: 0 5px;
|
padding: 0 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.tag {
|
||||||
|
max-width: 180px;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
&.pool {
|
&.pool {
|
||||||
padding-left: 5px;
|
padding-left: 5px;
|
||||||
|
@ -8,10 +8,14 @@ import { SinglePoolStats } from '../../../interfaces/node-api.interface';
|
|||||||
|
|
||||||
type MerkleCellType = ' ' | '┬' | '├' | '└' | '│' | '─' | 'leaf';
|
type MerkleCellType = ' ' | '┬' | '├' | '└' | '│' | '─' | 'leaf';
|
||||||
|
|
||||||
|
interface TaggedStratumJob extends StratumJob {
|
||||||
|
tag: string;
|
||||||
|
}
|
||||||
|
|
||||||
interface MerkleCell {
|
interface MerkleCell {
|
||||||
hash: string;
|
hash: string;
|
||||||
type: MerkleCellType;
|
type: MerkleCellType;
|
||||||
job?: StratumJob;
|
job?: TaggedStratumJob;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface MerkleTree {
|
interface MerkleTree {
|
||||||
@ -22,10 +26,25 @@ interface MerkleTree {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface PoolRow {
|
interface PoolRow {
|
||||||
job: StratumJob;
|
job: TaggedStratumJob;
|
||||||
merkleCells: MerkleCell[];
|
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({
|
@Component({
|
||||||
selector: 'app-stratum-list',
|
selector: 'app-stratum-list',
|
||||||
templateUrl: './stratum-list.component.html',
|
templateUrl: './stratum-list.component.html',
|
||||||
@ -60,7 +79,11 @@ export class StratumList implements OnInit, OnDestroy {
|
|||||||
this.websocketService.startTrackStratum('all');
|
this.websocketService.startTrackStratum('all');
|
||||||
}
|
}
|
||||||
|
|
||||||
processJobs(jobs: Record<string, StratumJob>): PoolRow[] {
|
processJobs(rawJobs: Record<string, StratumJob>): PoolRow[] {
|
||||||
|
const jobs: Record<string, TaggedStratumJob> = {};
|
||||||
|
for (const [id, job] of Object.entries(rawJobs)) {
|
||||||
|
jobs[id] = { ...job, tag: parseTag(job.scriptsig) };
|
||||||
|
}
|
||||||
if (Object.keys(jobs).length === 0) {
|
if (Object.keys(jobs).length === 0) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user