From 7e1d07ec952b2c8422799444d9b3e264c66c1ddc Mon Sep 17 00:00:00 2001 From: Jason Rhinelander Date: Sat, 27 Mar 2021 17:41:50 -0300 Subject: [PATCH] Add HF18 decomm/dereg reason display --- templates/include/tx_state_reason.html | 21 ++++++++++++++++ templates/tx.html | 34 +++++++++++++++++++++++--- 2 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 templates/include/tx_state_reason.html diff --git a/templates/include/tx_state_reason.html b/templates/include/tx_state_reason.html new file mode 100644 index 0000000..b4500e8 --- /dev/null +++ b/templates/include/tx_state_reason.html @@ -0,0 +1,21 @@ +{%- macro display(reason, some=false) -%} + {% if reason == 'uptime' -%} + Missing Uptime Proofs + {% elif reason == 'checkpoints' -%} + Missed too many checkpoint votes + {% elif reason == 'pulse' -%} + Missed too many pulse quorums + {% elif reason == 'storage' -%} + Oxen Storage Server is not reachable + {% elif reason == 'timecheck' -%} + SN is not responding to time checks + {% elif reason == 'timesync' -%} + SN's system clock is too far off + {% else -%} + Unknown reason ("{{reason}}") + {% endif -%} + + {% if some %} + (non-unanimous) + {% endif -%} +{% endmacro -%} diff --git a/templates/tx.html b/templates/tx.html index e221dc1..f7d189d 100644 --- a/templates/tx.html +++ b/templates/tx.html @@ -1,5 +1,9 @@ {% extends "_basic.html" %} +{% import 'include/tx_type_symbol.html' as sym %} +{% import 'include/tx_fee.html' as fee %} +{% import 'include/tx_state_reason.html' as readable_reason %} + {% block content %}
@@ -42,7 +46,6 @@ {{tx.received_timestamp | from_timestamp | format_datetime('short')}} UTC ({{tx.received_timestamp | from_timestamp | ago}} ago) {%endif%} - {% import 'include/tx_type_symbol.html' as sym %} {{tx.info.version}}/{{sym.display(tx, text=true)}} {%if not have_raw_tx%} {%if 'block_timestamp' in tx%} @@ -56,7 +59,6 @@ {%if tx.coinbase or 'rct_signatures' not in tx.info%} N/A {%else%} - {% import 'include/tx_fee.html' as fee %} {{fee.display(tx)}} ({{(tx.info.rct_signatures.txnFee * 1000 / tx.size) | oxen(tag=false, decimals=6)}}) {%endif%} @@ -81,11 +83,14 @@ {% if tx.info.version >= 4 -%} {% if tx.info.type == 1 and 'sn_state_change' in tx.extra %}

- {%- if tx.extra.sn_state_change.type == 'decom' -%} + {%- set show_reasons = false -%} + {% if tx.extra.sn_state_change.type == 'decom' -%} + {% set show_reasons = true -%} 👎 Service Node Decommission Metadata {% elif tx.extra.sn_state_change.type == 'recom' -%} 👍 Service Node Recommission Metadata {% elif tx.extra.sn_state_change.type == 'dereg' -%} + {% set show_reasons = true -%} 🚫 Service Node Deregistration Metadata {% elif tx.extra.sn_state_change.type == 'ip' -%} 📋 Service Node IP Change Metadata @@ -98,6 +103,29 @@ {%set sn_index = tx.extra.sn_state_change.index%} {%if testing_quorum%}

Service Node Public Key: {{testing_quorum.workers[sn_index]}}

+ {%endif%} + + {%if show_reasons%} +

{%if tx.extra.sn_state_change.type == 'decom'%}Decommission{%else%}Deregistration{%endif%} Reason(s):

+ + {%endif%} + + {%if testing_quorum%}

Testing quorum {{tx.extra.sn_state_change.height}}