consensus/cmd/web/views/tpl_found_blocks.qtpl
DataHoarder 4ef60296f1
Updated to Go 1.21
* Replaced exp/slices and exp/maps with slices/maps implementation
* Replaced utils.Min/Max with min/max
* Introduced GOEXPERIMENT=loopvar on build steps
* Updated tests/docker-compose to go1.21-rc-alpine
* Updated nginx to 1.25
* Preallocate mined blocks on Sidechain
* Update edwards25519 version
2023-07-20 07:40:18 +02:00

57 lines
3.3 KiB
Plaintext

{% import "git.gammaspectra.live/P2Pool/p2pool-observer/index" %}
{% import "git.gammaspectra.live/P2Pool/p2pool-observer/types" %}
{% import "slices" %}
{% import "github.com/ake-persson/mapslice-json" %}
{% func TemplateFoundBlocks(ctx *GlobalRequestContext, foundBlocks []*index.FoundBlock, isMiner bool) %}
<table class="center datatable" style="max-width: calc(8em + 8em + 8em + 8em{% if isMiner %}{% else %} + 12em + 8em{% endif %} + 10em + 7em + 12em + 28em)">
<tr>
<th style="width: 8em;">Monero Height</th>
<th style="width: 8em;">P2Pool Height</th>
<th style="width: 8em;">Age <small>[h:m:s]</small></th>
{% if !isMiner %}
<th style="width: 8em;">Effort</th>
<th style="width: 12em;" title="The P2Pool miner who found this block">Found by</th>
{% endif %}
<th style="width: 8em;">Transactions</th>
<th style="width: 10em;">Total Reward</th>
<th style="width: 7em;" title="Number of miners that got paid on the Coinbase Transaction">Outputs</th>
<th style="width: 12em;">Coinbase Transaction</th>
<th style="width: 28em;" title="You can use this Private Key to verify payouts sent by P2Pool on each block through the Coinbase Transaction">Coinbase Tx Private Key</th>
</tr>
{% for i, b := range foundBlocks %}
<tr>
<th title="{%s hex(b.MainBlock.Id) %}"><a href="/b/{%s benc(b.MainBlock.Height) %}">{%dul b.MainBlock.Height %}</a></th>
{% if b.UncleOf != types.ZeroHash %}
<th title="{%s hex(b.MainBlock.SideTemplateId) %} is an uncle of height {%dul b.EffectiveHeight %}, {%s hex(b.UncleOf) %}">
<a href="/share/{%s hex(b.MainBlock.SideTemplateId) %}">{%dul b.SideHeight %}*</a>
</th>
{% else %}
<th title="{%s hex(b.MainBlock.SideTemplateId) %}">
<a href="/share/{%s hex(b.MainBlock.SideTemplateId) %}">{%dul b.SideHeight %}</a>
</th>
{% endif %}
<td title="{%s utc_date(b.MainBlock.Timestamp) %}">{%s date_diff_short(b.MainBlock.Timestamp) %}</td>
{% if !isMiner %}
{% if len(foundBlocks) > (i+1) %}
<td style="font-weight:bolder; color: {%s effort_color(found_block_effort(b, foundBlocks[i+1])) %};">
{%f.2 found_block_effort(b, foundBlocks[i+1]) %}%
</td>
{% elseif effortIndex := slices.IndexFunc(ctx.Pool.SideChain.Effort.Last, func(e mapslice.MapItem) bool { return e.Key.(string) == b.MainBlock.Id.String() }); effortIndex != -1 %}
<td style="font-weight:bolder; color: {%s effort_color(ctx.Pool.SideChain.Effort.Last[effortIndex].Value.(float64)) %};">
{%f.2 ctx.Pool.SideChain.Effort.Last[effortIndex].Value.(float64) %}%
</td>
{% else %}
<td>unknown</td>
{% endif %}
{%= TemplateRowMiner(b.MinerAddress, b.MinerAlias) %}
{% endif %}
<td>{%dul uint64(b.TransactionCount) %}</td>
<th class="small">{%s monero_to_xmr(b.MainBlock.Reward) %} XMR</th>
<td>{%dul uint64(b.WindowOutputs) %}</td>
<td title="{%s hex(b.MainBlock.CoinbaseId) %}" class="mono small"><a href="/t/{%s henc(b.MainBlock.CoinbaseId) %}">{%s shorten(hex(b.MainBlock.CoinbaseId), 10) %}</a></td>
<td class="mono smaller">{%s hex(b.MainBlock.CoinbasePrivateKey) %}</td>
</tr>
{% endfor %}
</table>
{% endfunc %}