mirror of
https://github.com/mempool/mempool.git
synced 2024-11-19 01:41:01 +01:00
add coinbase tag column to stratum table
This commit is contained in:
parent
55f428ce9f
commit
43dc617cb3
@ -9,6 +9,7 @@
|
||||
<tr>
|
||||
<td class="height">Height</td>
|
||||
<td class="reward">Reward</td>
|
||||
<td class="tag">Coinbase Tag</td>
|
||||
<td class="merkle" [attr.colspan]="rows[0]?.merkleCells?.length || 4">
|
||||
Merkle Branches
|
||||
</td>
|
||||
@ -24,6 +25,9 @@
|
||||
<td class="reward">
|
||||
<app-amount [satoshis]="row.job.reward"></app-amount>
|
||||
</td>
|
||||
<td class="tag">
|
||||
{{ row.job.tag }}
|
||||
</td>
|
||||
@for (cell of row.merkleCells; track $index) {
|
||||
<td class="merkle" [style.background-color]="cell.hash ? '#' + cell.hash.slice(0, 6) : ''">
|
||||
<div class="pipe-segment" [class]="pipeToClass(cell.type)"></div>
|
||||
|
@ -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;
|
||||
|
@ -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<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) {
|
||||
return [];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user