HF10 updates

- Show batched payout rewards rather than "16.5" which isn't a
  particularly relevant value anymore.
- Add total batched earnings to the index
- Update math for 10 contribution spots
- Update to show HF19 registration details
- Fix bug where the first tx in a no-payout block was not shown on the
  block details page
This commit is contained in:
Jason Rhinelander 2022-06-14 20:18:28 -03:00
parent 71ae2e5044
commit 5665010003
6 changed files with 30 additions and 17 deletions

View File

@ -272,6 +272,7 @@ def main(refresh=None, page=0, per_page=None, first=None, last=None, style=None)
stake = FutureJSON(omq, oxend, 'rpc.get_staking_requirement', 10)
base_fee = FutureJSON(omq, oxend, 'rpc.get_fee_estimate', 10)
hfinfo = FutureJSON(omq, oxend, 'rpc.hard_fork_info', 10)
accrued = FutureJSON(omq, oxend, 'rpc.get_accrued_batched_earnings', 1)
mempool = get_mempool_future(omq, oxend)
sns = get_sns_future(omq, oxend)
checkpoints = FutureJSON(omq, oxend, 'rpc.get_checkpoints', args={"count": 3})
@ -350,6 +351,7 @@ def main(refresh=None, page=0, per_page=None, first=None, last=None, style=None)
stake=stake.get(),
fees=base_fee.get(),
emission=coinbase.get(),
accrued_total=sum(accrued.get()['amounts']),
hf=hfinfo.get(),
active_sns=active_sns,
active_swarms=len(set(x['swarm_id'] for x in active_sns)),
@ -647,7 +649,9 @@ def get_block_txs_future(omq, oxend, block):
hashes = []
if 'tx_hashes' in block:
hashes += block['tx_hashes']
hashes.append(block['block_header']['miner_tx_hash'])
miner_tx = block['block_header'].get('miner_tx_hash')
if miner_tx:
hashes.append(miner_tx)
if 'info' not in block:
try:
block['info'] = json.loads(block["json"])
@ -699,7 +703,7 @@ def show_block(height=None, hash=None, more_details=False):
more_details = {}
transactions = [] if txs is None else parse_txs(txs.get()).copy()
miner_tx = transactions.pop() if transactions else []
miner_tx = transactions.pop() if block['block_header'].get('miner_tx_hash') else None
return flask.render_template("block.html",
info=info.get(),

View File

@ -18,7 +18,7 @@
<h2 style="margin-bottom: 0px">Active Service Nodes <span class="sn-count">({{active_sns | count}})</span></h2>
<h4 class="Subtitle">Current storage swarm count:
<span class="sn-count" title="= {{"%.2f"|format(active_sns | count / active_swarms)}} SNs per swarm">{{active_swarms}}</span>
<span class="sn-count"{%if active_swarms > 0%} title="= {{"%.2f"|format(active_sns | count / active_swarms)}} SNs per swarm"{%endif%}>{{active_swarms}}</span>
</h4>
<div class="TitleDivider sn-active"></div>
{%include 'include/sn_active.html'%}

View File

@ -13,6 +13,7 @@
</thead>
<tbody>
{%set max_contributors = 10 if 'hard_fork' in info and info.hard_fork >= 19 else 4 %}
{%for sn in (awaiting_sns | sort(attribute='portions_for_operator,contribution_open,contribution_required,service_node_pubkey'))[:limit_awaiting]%}
<tr>
{%include 'include/sn_kcf.html'%}
@ -24,7 +25,7 @@
{%else%}
<td>{{sn.contribution_open | oxen(tag=false, fixed=true)}}</td>
{%endif%}
<td>{{ (0 if sn.num_contributions >= 4 else (sn.contribution_open / (4 - sn.num_contributions)) | round(method='ceil')) | oxen(tag=false, fixed=true) }}</td>
<td>{{ (0 if sn.num_contributions >= 4 else (sn.contribution_open / (max_contributors - sn.num_contributions)) | round(method='ceil')) | oxen(tag=false, fixed=true) }}</td>
<td>
{%if sn.requested_unlock_height%}
<span title="Service Node unlock in progress (unlocks at block {{sn.requested_unlock_height}})">🔓</span>

View File

@ -2,9 +2,10 @@
{%-set portions_base = 2**64 - 4-%}
{%-set solo_node = sn.contributors|length == 1 and sn.funded %}
{%-set max_contributors = 10 if 'hard_fork' in info and info.hard_fork >= 19 else 4 %}
<td><a href="/sn/{{sn.service_node_pubkey}}">{{sn.service_node_pubkey}}</a></td>
<td title="
{%-for c in sn.contributors%}{%for lc in c.locked_contributions%}{{c.address | truncate(15)}} ({{lc.amount | oxen(decimals=0)}} = {{(lc.amount / sn.staking_requirement * 100) | round(1) | chop0}}%)
{%endfor%}{%endfor%}"><span class="icon">{{sn.contributors | length}}/4</span></td>
<td>{%if not solo_node%}{{ (sn.portions_for_operator / portions_base * 100) | round(3) | chop0 }}{%endif%}</td>
{%endfor%}{%endfor%}"><span class="icon">{{sn.contributors | length}}/{{max_contributors}}</span></td>
<td>{%if not solo_node%}{{ (sn.portions_for_operator / portions_base * 100) | round(2) | chop0 }}{%endif%}</td>

View File

@ -60,7 +60,7 @@
{% if info %}
<h3 class="general_info info_list nowrap-spans">
<span><label>Height:</label> {{info.height}}</span>
<span><label>Hard fork:</label> v{{hf.version}}</span>
<span><label>Hard fork:</label> v{{hf.version}}{%if 'revision' in hf%}.{{hf.revision}}{%endif%}</span>
{% if hf.version >= 16 %}
<span title="{{ info.pulse_target_timestamp | from_timestamp | format_datetime }}
{%-if info.pulse_target_timestamp != info.pulse_ideal_timestamp %}
@ -97,9 +97,10 @@
(still calculating...)</span>
{% elif emission.status == 'OK' %}
{{(emission.emission_amount - emission.burn_amount) | oxen}}</span>
<span><label>(Coinbase:</label> {{emission.emission_amount | oxen}}</span>
<span><label>Fees:</label> {{emission.fee_amount | oxen}}</span>
<span><label>Burned:</label> {{emission.burn_amount | oxen}}<label>).</label></span>
<span title="Gross emitted coins"><label>(Coinbase:</label> {{emission.emission_amount | oxen}}</span>
<span title="Transfers paid as transaction fees"><label>Fees:</label> {{emission.fee_amount | oxen}}</span>
<span title="Permanently destroyed (&quot;burned&quot;) fees"><label>Burned:</label> {{emission.burn_amount | oxen}}</span>
<span title="Accrued batch rewards not yet paid out"><label>Batched:</label> {{accrued_total | oxen}}</span><label>).</label>
{%endif%}
<p style="padding: 0px; margin-top: 2px; font-size: 0.9em">
* — The circulating supply may exclude any currently publicised locked OXEN; otherwise it is equal to the coinbase minus the number of burned coins.
@ -156,7 +157,7 @@
<td>Type</td>
<td>Transaction Hash</td>
<td>Fee</td>
<td>Outputs</td>
<td title="Batched reward payments">Rewards</td>
<td>In/Out</td>
<td>TX Size</td>
</tr>
@ -165,7 +166,9 @@
{% import 'include/tx_type_symbol.html' as symbol %}
{% import 'include/tx_fee.html' as fee %}
{% for b in blocks | reverse %}
{% if b.txs | length > 0 %}
{% set tx_i = 0 %}
{% if b.txs | length > 0 and b.txs[0].coinbase %}
{% set tx_i = 1 %}
<tr class="block">
<td><a href="/block/{{b.height}}">{{b.height}}</a></td>
<td title="{{b.timestamp | from_timestamp | format_datetime}}">{{b.timestamp | from_timestamp | ago}}</td>
@ -173,7 +176,7 @@
<td>{{symbol.display(b.txs[0])}}</td>
<td><a href="/tx/{{b.txs[0].tx_hash}}">{{b.txs[0].tx_hash}}</a></td>
<td>{{fee.display(b.txs[0])}}</td>
<td>{{b.reward | oxen(tag=False, fixed=True, decimals=2)}}</td>
<td>{{b.coinbase_payouts | oxen(tag=False, fixed=True, decimals=2)}}</td>
<td>0/{{b.txs[0].info.vout | length}}</td>
<td>{{b.txs[0].size | si}}</td>
</tr>
@ -186,12 +189,12 @@
<td></td>
<td></td>
<td></td>
<td>{{b.reward | oxen(tag=False, fixed=True, decimals=2)}}</td>
<td></td>
<td></td>
<td></td>
</tr>
{%endif%}
{% for tx in b.txs[1:] %}
{% for tx in b.txs[tx_i:] %}
<tr class="tx">
<td></td>
<td></td>

View File

@ -180,8 +180,12 @@ This tx does not includes a vote from this testing service node (only 7 votes ar
{%else%}{{(tx.extra.sn_registration.fee / 10000) | chop0}}%
{%endif%}</p>
<p><label>Contribution Amount:</label> {%if 'stake_amount' in tx%}{{tx.stake_amount | oxen}}{%else%}???{%endif%}</p>
<p><label>Expiration:</label> {{tx.extra.sn_registration.expiry | from_timestamp | format_datetime}} ({{tx.extra.sn_registration.expiry}}),
or {{(tx.extra.sn_registration.expiry|from_timestamp - server.datetime) | reltime}}</p>
{%if 'expiry' in tx.extra.sn_registration%}
<p><label>Expiration:</label> {{tx.extra.sn_registration.expiry | from_timestamp | format_datetime}} ({{tx.extra.sn_registration.expiry}}),
or {{(tx.extra.sn_registration.expiry|from_timestamp - server.datetime) | reltime}}</p>
{%elif 'hardfork' in tx.extra.sn_registration%}
<p><label>Registration Hardfork:</label> {{tx.extra.sn_registration.hardfork}}</p>
{%endif%}
<h2>Service Node Registration Address(es)</h2>
<div class="TitleDivider"></div>