Add next-test time to SN details page
This commit is contained in:
parent
77b7617ab7
commit
9f4d6dca89
|
@ -33,6 +33,8 @@ else:
|
|||
|
||||
app = flask.Flask(__name__)
|
||||
|
||||
app.jinja_options['extensions'].append('jinja2.ext.loopcontrols')
|
||||
|
||||
class Hex64Converter(BaseConverter):
|
||||
def __init__(self, url_map):
|
||||
super().__init__(url_map)
|
||||
|
@ -420,6 +422,8 @@ def show_sn(pubkey):
|
|||
info = FutureJSON(lmq, oxend, 'rpc.get_info', 1)
|
||||
hfinfo = FutureJSON(lmq, oxend, 'rpc.hard_fork_info', 10)
|
||||
sn = sn_req(lmq, oxend, pubkey).get()
|
||||
quos = get_quorums_future(lmq, oxend, info.get()['height'])
|
||||
|
||||
|
||||
if 'service_node_states' not in sn or not sn['service_node_states']:
|
||||
return flask.render_template('not_found.html',
|
||||
|
@ -442,6 +446,7 @@ def show_sn(pubkey):
|
|||
info=info.get(),
|
||||
hf=hfinfo.get(),
|
||||
sn=sn,
|
||||
quorums=get_quorums(quos)
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -124,6 +124,28 @@
|
|||
{%if sn.swarm_id == 18446744073709551615%}(none){%else%}0x{{'{:016x}'.format(sn.swarm_id)}}{%endif%}
|
||||
</span>
|
||||
|
||||
<!--<pre>{{quorums}}</pre>-->
|
||||
{%set next_test = namespace(height=none)%}
|
||||
{%for q in quorums.obligation[-13:]%}
|
||||
{%if next_test.height%}{%break%}{%endif%}
|
||||
{%if q.height + 13 >= info.height%}
|
||||
{%for w in q.quorum.workers%}
|
||||
{%if w == sn.service_node_pubkey%}
|
||||
{%set next_test.height = q.height + 13%}
|
||||
{%break%}
|
||||
{%endif%}
|
||||
{%endfor%}
|
||||
{%endif%}
|
||||
{%endfor%}
|
||||
<span title="Next SN test">
|
||||
<label>Next SN test:</label>
|
||||
{%if next_test.height%}
|
||||
Block {{next_test.height}}
|
||||
({%if next_test.height == info.height%}Now!{%else%}~{{((next_test.height - info.height) * 120) | reltime(in_ago=false)}}{%endif%})
|
||||
{%else%}
|
||||
<span title=">12 blocks (~24 minutes): future test quorums are only known 12 blocks in advance">Unknown</span>
|
||||
{%endif%}
|
||||
</span>
|
||||
|
||||
</h4>
|
||||
|
||||
|
|
Loading…
Reference in New Issue