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 %}
+
+ {% 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 @@
In mempool since: {{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 Version/Type: {{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):
+
+ {%if tx.extra.sn_state_change.reasons or tx.extra.sn_state_change.reasons%}
+ {%if tx.extra.sn_state_change.reasons%}
+ {%for r in tx.extra.sn_state_change.reasons%}
+ {{ readable_reason.display(r) }}
+ {%endfor%}
+ {%endif%}
+ {%if tx.extra.sn_state_change.reasons_some%}
+ {%for r in tx.extra.sn_state_change.reasons_some%}
+ {{ readable_reason.display(r, true) }}
+ {%endfor%}
+ {%endif%}
+ {%else%}
+ Reasons not available
+ {%endif%}
+
+ {%endif%}
+
+ {%if testing_quorum%}
Testing quorum {{tx.extra.sn_state_change.height}}