Add SN and quorum info to state change tx page
This commit is contained in:
parent
419746d017
commit
7ffbbb2d7e
15
observer.py
15
observer.py
|
@ -525,6 +525,12 @@ def show_tx(txid, more_details=False):
|
|||
)
|
||||
tx = parse_txs(txs)[0]
|
||||
|
||||
# If this is a state change, see if we have the quorum stored to provide context
|
||||
testing_quorum = None
|
||||
if tx['info']['version'] >= 4 and 'sn_state_change' in tx['extra']:
|
||||
testing_quorum = FutureJSON(lmq, lokid, 'rpc.get_quorum_state', 60, cache_key='tx_state_change',
|
||||
args={ 'quorum_type': 0, 'start_height': tx['extra']['sn_state_change']['height'] })
|
||||
|
||||
kindex_info = {} # { amount => { keyindex => {output-info} } }
|
||||
block_info_req = None
|
||||
if 'vin' in tx['info']:
|
||||
|
@ -582,11 +588,20 @@ def show_tx(txid, more_details=False):
|
|||
for bh in bi['block_headers']:
|
||||
block_info[bh['height']] = bh
|
||||
|
||||
|
||||
if testing_quorum:
|
||||
testing_quorum = testing_quorum.get()
|
||||
if 'quorums' in testing_quorum and testing_quorum['quorums']:
|
||||
testing_quorum = testing_quorum['quorums'][0]['quorum']
|
||||
else:
|
||||
testing_quorum = None
|
||||
|
||||
return flask.render_template('tx.html',
|
||||
info=info.get(),
|
||||
tx=tx,
|
||||
kindex_info=kindex_info,
|
||||
block_info=block_info,
|
||||
testing_quorum=testing_quorum,
|
||||
**more_details,
|
||||
)
|
||||
|
||||
|
|
|
@ -415,6 +415,26 @@ td.quorum-pubkey span {
|
|||
text-align: left;
|
||||
}
|
||||
|
||||
div.tx-state-change-quorum div.workers {
|
||||
border-top: 2px solid #008522;
|
||||
}
|
||||
div.tx-state-change-quorum div.validators .sn.voted,
|
||||
div.tx-state-change-quorum div.workers .sn.testee {
|
||||
background-color: #006a1b;
|
||||
border-color: #78be20;
|
||||
color: #78be20;
|
||||
}
|
||||
.quorums div.tx-state-change-quorum .sn:hover {
|
||||
background-color: #78be20 !important;
|
||||
border-color: #006a1b !important;
|
||||
color: #006a1b !important;
|
||||
}
|
||||
|
||||
/*div.tx-state-change-quorum>div>.sn {
|
||||
flex-basis: 100px;
|
||||
}*/
|
||||
|
||||
|
||||
th.subheader {
|
||||
text-align: left;
|
||||
border-bottom: 2px solid #008522;
|
||||
|
|
|
@ -94,33 +94,42 @@
|
|||
{% endif -%}
|
||||
</h2>
|
||||
|
||||
{#FIXME -- all the values below need to be fixed#}
|
||||
<div class="TitleDivider"></div>
|
||||
{%if state_change_have_pubkey_info%}
|
||||
<p class="state-change-pubkey">Service Node Public Key: <a href="/sn/{{state_change_service_node_pubkey}}">{{state_change_service_node_pubkey}}</a></p>
|
||||
{%set sn_index = tx.extra.sn_state_change.index%}
|
||||
{%if testing_quorum%}
|
||||
<p class="state-change-pubkey">Service Node Public Key: <a href="/sn/{{testing_quorum.workers[sn_index]}}">{{testing_quorum.workers[sn_index]}}</a></p>
|
||||
<div class="quorums">
|
||||
<div class="tx-state-change-quorum">
|
||||
<h2>Testing quorum {{tx.extra.sn_state_change.height}}</h2>
|
||||
|
||||
{%set voters = tx.extra.sn_state_change.voters%}
|
||||
<div class="validators">
|
||||
<label>Validators:</label>
|
||||
{%for v in testing_quorum.validators%}
|
||||
<a
|
||||
{%if loop.index0 in voters%} class="sn voted" title="{{v}}
|
||||
This tx includes a verified vote by this testing service node."
|
||||
{%else%} class="sn" title="{{v}}
|
||||
This tx does not includes a vote from this testing service node (only 7 votes are needed)."
|
||||
{%endif%}
|
||||
href="/sn/{{v}}">{{v}}</a>
|
||||
{%endfor%}
|
||||
</div>
|
||||
<div class="workers">
|
||||
<label>SNs tested:</label>
|
||||
{%for w in testing_quorum.workers%}
|
||||
<a class="sn{%if loop.index0 == sn_index%} testee{%endif%}"
|
||||
href="/sn/{{w}}" title="{{w}}">{{w}}</a>
|
||||
{%endfor%}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{%else%}
|
||||
<div title="This quorum information is no longer available (only recent quorum data is stored)">
|
||||
<p>Service Node Index: {{sn_index}}</p>
|
||||
<p>Testing quorum: {{tx.extra.sn_state_change.height}}</a></p>
|
||||
</div>
|
||||
{%endif%}
|
||||
<p>Service Node Index: {{state_change_service_node_index}}</p>
|
||||
<p>Block Height: <a href="/block/{{state_change_block_height}}">{{state_change_block_height}}</a></p>
|
||||
|
||||
<table class="Table">
|
||||
<tr class="TableHeader">
|
||||
<th class="voter-index">Voters Quorum Index</th>
|
||||
{%if state_change_have_pubkey_info%}
|
||||
<th class="voter-pubkey">Voter Public Key</th>
|
||||
{%endif%}
|
||||
<th class="voter-signature">Signature</th>
|
||||
</tr>
|
||||
|
||||
{%if state_change_vote_array%}
|
||||
<tr>
|
||||
<td class="voter-index">{{state_change_voters_quorum_index}}</td>
|
||||
{%if state_change_have_pubkey_info%}
|
||||
<td class="voter-pubkey"><a href="/sn/{{state_change_voter_pubkey}}">{{state_change_voter_pubkey}}</a></td>
|
||||
{%endif%}
|
||||
<td class="voter-signature" title="{{state_change_signature}}">{{state_change_signature}}</td>
|
||||
</tr>
|
||||
{%endif%}
|
||||
</table>
|
||||
|
||||
{% elif tx.info.type == 2 %}
|
||||
<h2>🔓 Service Node Unlock</h2>
|
||||
|
@ -174,31 +183,33 @@
|
|||
{% endif %}
|
||||
|
||||
|
||||
<h2>Outputs</h2>
|
||||
<h4 class="Subtitle">{{tx.info.vout|length}} output(s) for total of
|
||||
{{tx.info.vout | sum(attribute='amount') | loki(zero='<span title="Regular LOKI tx amounts are private">???</span>') | safe}}</h4>
|
||||
<div class="TitleDivider"></div>
|
||||
<div class="tx-outputs">
|
||||
<table class="Table">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>Stealth Address</td>
|
||||
<td>Amount</td>
|
||||
<td title="Global blockchain output counter">Output Index</td>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{%for out in tx.info.vout%}
|
||||
{%if tx.info.vout%}
|
||||
<h2>Outputs</h2>
|
||||
<h4 class="Subtitle">{{tx.info.vout|length}} output(s) for total of
|
||||
{{tx.info.vout | sum(attribute='amount') | loki(zero='<span title="Regular LOKI tx amounts are private">???</span>') | safe}}</h4>
|
||||
<div class="TitleDivider"></div>
|
||||
<div class="tx-outputs">
|
||||
<table class="Table">
|
||||
<thead>
|
||||
<tr>
|
||||
<td><label>{{loop.index0}}:</label> {{out.target.key}}</td>
|
||||
<td>{{out.amount | loki(zero='?')}}</td>
|
||||
<td>{%if 'output_indices' in tx%}{{tx.output_indices[loop.index0]}}{# FIXME: of {{num_outputs}}#}{%endif%}</td>
|
||||
<td>Stealth Address</td>
|
||||
<td>Amount</td>
|
||||
<td title="Global blockchain output counter">Output Index</td>
|
||||
</tr>
|
||||
{%endfor%}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{%for out in tx.info.vout%}
|
||||
<tr>
|
||||
<td><label>{{loop.index0}}:</label> {{out.target.key}}</td>
|
||||
<td>{{out.amount | loki(zero='?')}}</td>
|
||||
<td>{%if 'output_indices' in tx%}{{tx.output_indices[loop.index0]}}{# FIXME: of {{num_outputs}}#}{%endif%}</td>
|
||||
</tr>
|
||||
{%endfor%}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{%endif%}
|
||||
|
||||
{#FIXME
|
||||
{%if not have_raw_tx%}
|
||||
|
|
Loading…
Reference in New Issue