Skip to content

Commit

Permalink
Fix get block template
Browse files Browse the repository at this point in the history
  • Loading branch information
everoddandeven committed Oct 29, 2024
1 parent ef15fa5 commit 816161c
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
51 changes: 51 additions & 0 deletions src/app/pages/mining/mining.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,57 @@ <h4><i class="bi bi-exclamation-triangle m-2"></i></h4>&nbsp;&nbsp;
</div>
</div>

<div *ngIf="blockTemplate" class="card">
<div class="card-header bg-dark text-white">
<h4>Block Template</h4>
</div>
<div class="card-body">

<div class="row">
<div class="col-md-12">
<h6>Block Template Blob</h6>
<p class="text-break bg-dark p-2">{{ blockTemplate.blockTemplateBlob }}</p>
</div>
</div>

<div class="row mt-4">
<div class="col-md-12">
<h6>Block Header</h6>
<div class="card">
<div class="card-body">
<ul class="list-group">
<li class="list-group-item"><strong>Block Hashing Blob:</strong> {{ blockTemplate.blockHashingBlob }} bytes</li>
<li class="list-group-item"><strong>Height:</strong> {{ blockTemplate.height }}</li>
<li class="list-group-item"><strong>Previous Hash:</strong> {{ blockTemplate.prevHash }}</li>
<li class="list-group-item"><strong>Expected Reward:</strong> {{ blockTemplate.expectedRewardXMR }} XMR</li>
<li class="list-group-item"><strong>Difficulty:</strong> {{ blockTemplate.difficulty }}</li>
<li class="list-group-item"><strong>Wide Difficulty:</strong> {{ blockTemplate.wideDifficulty }}</li>
<li class="list-group-item"><strong>Reserved Offset:</strong> {{ blockTemplate.reservedOffset }}</li>
</ul>
</div>
</div>
</div>
</div>

<div class="row mt-4">
<div class="col-md-12">
<h6>Seed</h6>
<div class="card">
<div class="card-body">
<ul class="list-group">
<li class="list-group-item"><strong>Seed Hash:</strong> {{ blockTemplate.seedHash }}</li>
<li class="list-group-item"><strong>Seed Height:</strong> {{ blockTemplate.seedHeight }}</li>
<li class="list-group-item"><strong>Next Seed Hash:</strong> {{ blockTemplate.nextSeedHash }}</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>

<hr *ngIf="blockTemplate" class="my-4">

<div class="row g-5 p-2">
<div class="cold-md-7 col-lg-12">
<div class="row gy-3">
Expand Down
4 changes: 4 additions & 0 deletions src/common/BlockTemplate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ export class BlockTemplate {
public readonly untrusted: boolean;
public readonly wideDifficulty: string;

public get expectedRewardXMR(): number {
return this.expectedReward / 1e12;
}

constructor(blockHashingBlob: string, blockTemplateBlob: string, difficulty: number, difficultyTop64: number, expectedReward: number, height: number, nextSeedHash: string, prevHash: string, reservedOffset: number, seedHash: string, seedHeight: number, status: string, untrusted: boolean, wideDifficulty: string) {
this.blockHashingBlob = blockHashingBlob;
this.blockTemplateBlob = blockTemplateBlob;
Expand Down

0 comments on commit 816161c

Please sign in to comment.