DataHoarder
55661a12da
All checks were successful
continuous-integration/drone/push Build is passing
95 lines
4.1 KiB
Plaintext
95 lines
4.1 KiB
Plaintext
{% import "git.gammaspectra.live/P2Pool/p2pool-observer/monero/address" %}
|
|
{% import cmdutils "git.gammaspectra.live/P2Pool/p2pool-observer/cmd/utils" %}
|
|
{% import types "git.gammaspectra.live/P2Pool/p2pool-observer/types" %}
|
|
{% import p2pooltypes "git.gammaspectra.live/P2Pool/p2pool-observer/p2pool/types" %}
|
|
|
|
{% code
|
|
type MinersPage struct {
|
|
// inherit from base page, so its' title is used in error page.
|
|
BasePage
|
|
Refresh int
|
|
Weekly bool
|
|
Miners []*MinersPageMinerEntry
|
|
WindowWeight types.Difficulty
|
|
}
|
|
|
|
func (p *MinersPage) Name() string {
|
|
return "miners"
|
|
}
|
|
|
|
func (p *MinersPage) IsRefresh() (ok, isRefresh bool, interval int, uriRefresh, uriStatic string) {
|
|
if p.Weekly {
|
|
return true, p.Refresh > 0, p.Refresh, "/miners?week&refresh", "/miners?week"
|
|
} else {
|
|
return true, p.Refresh > 0, p.Refresh, "/miners?refresh", "/miners"
|
|
}
|
|
}
|
|
|
|
%}
|
|
|
|
{% code
|
|
type MinersPageMinerEntry struct {
|
|
Address *address.Address
|
|
Alias string
|
|
SoftwareId p2pooltypes.SoftwareId
|
|
SoftwareVersion p2pooltypes.SoftwareVersion
|
|
Weight types.Difficulty
|
|
Shares *cmdutils.PositionChart
|
|
Uncles *cmdutils.PositionChart
|
|
}
|
|
%}
|
|
|
|
{% func (p *MinersPage) Title() %}
|
|
{% if p.Weekly %}
|
|
{%= p.BasePage.Title() %} - Current Window Miners
|
|
{% else %}
|
|
{%= p.BasePage.Title() %} - Weekly Miners
|
|
{% endif %}
|
|
{% endfunc %}
|
|
|
|
{% func (p *MinersPage) Content() %}
|
|
|
|
<div style="text-align: center">
|
|
|
|
{% if p.Weekly %}
|
|
<h2>Weekly Miners</h2>
|
|
<p>This is a list of the miners that have shares in the last 28 full windows, or about seven days.</p>
|
|
<p class="small">Entries are sorted by current window "weight". There are more total miners currently active, but without a share to show at the moment.</p>
|
|
<p class="small">Pool share % is relative to whole pool hashrate. Miners can join or leave anytime and there is no ceiling limit. </p>
|
|
<table class="center datatable" style="border-collapse: collapse; max-width: calc(4em + 12em + 10em + 8em + 8em + 12em + 32em)">
|
|
{% else %}
|
|
<h2>Current Window Miners</h2>
|
|
<p>This is a list of the miners that have shares in the current window, and would be rewarded when a Monero block is found within the window.</p>
|
|
<p class="small">Entries are sorted by current window "weight". There are more total miners currently active, but without a share to show at the moment.</p>
|
|
<p class="small">Pool share % is relative to whole pool hashrate. Miners can join or leave anytime and there is no ceiling limit. </p>
|
|
<table class="center datatable" style="border-collapse: collapse; max-width: calc(4em + 12em + 10em + 8em + 8em + 12em + 24em)">
|
|
{% endif %}
|
|
<tr>
|
|
<th style="width: 4em;">#</th>
|
|
<th style="width: 12em;">Miner</th>
|
|
<th style="width: 10em;">Software</th>
|
|
<th style="width: 8em;">Pool share %</th>
|
|
<th style="width: 8em;">Estimated Hashrate</th>
|
|
<th style="width: 12em;">Shares found</th>
|
|
<th style="width: {% if p.Weekly %}32{% else %}24{% endif %}em;">Shares position</th>
|
|
</tr>
|
|
{% for i, m := range p.Miners %}
|
|
<tr style="padding-bottom: 10px; border-bottom: solid #aaa 1px">
|
|
<td style="vertical-align: middle">{%d i+1 %}</td>
|
|
{%= TemplateRowMinerWithTag(p.Context(), m.Address, m.Alias, "th") %}
|
|
<td style="vertical-align: middle">{%= software_info(m.SoftwareId, m.SoftwareVersion) %}</td>
|
|
{% code minerRatio := float64(m.Weight.Lo) / float64(p.WindowWeight.Lo) %}
|
|
<td style="vertical-align: middle">{%f.3 minerRatio*100 %}%</td>
|
|
<td style="vertical-align: middle">{%s si_units(minerRatio * (float64(p.Context().Pool.SideChain.LastBlock.Difficulty) / float64(p.Context().Consensus.TargetBlockTime)), 3) %}H/s</td>
|
|
<td style="vertical-align: middle">{%dul m.Shares.Total() %} block(s) +{%dul m.Uncles.Total() %} uncle(s)</td>
|
|
<td>
|
|
<code class="mono small">{%s m.Shares.String() %}</code>
|
|
<br/>
|
|
<code class="mono small">{%s m.Uncles.String() %}</code>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</table>
|
|
</div>
|
|
|
|
{% endfunc %} |