From b9c1d2f098845df143432599ffff92c1a4af47e1 Mon Sep 17 00:00:00 2001 From: moneroexamples Date: Thu, 1 Dec 2016 09:11:31 +0800 Subject: [PATCH] added: output keys checker accounts for spend outputs --- src/page.h | 10 +++++++++- src/templates/checkrawoutputkeys.html | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/page.h b/src/page.h index d186022..ddbc57d 100644 --- a/src/page.h +++ b/src/page.h @@ -2538,18 +2538,26 @@ public: uint64_t blk_timestamp = core_storage ->get_db().get_block_timestamp(td.m_block_height); + const key_image& output_key_img = td.m_key_image; + + bool is_output_spent = core_storage->have_tx_keyimg_as_spent(output_key_img); + mstch::map output_info { {"output_no" , fmt::format("{:03d}", output_no)}, {"output_pub_key" , REMOVE_HASH_BRAKETS(fmt::format("{:s}", txout_key.key))}, {"amount" , xmreg::xmr_amount_to_str(xmr_amount)}, {"tx_hash" , REMOVE_HASH_BRAKETS(fmt::format("{:s}", td.m_txid))}, {"timestamp" , xmreg::timestamp_to_str(blk_timestamp)}, + {"is_spent" , is_output_spent}, {"is_ringct" , td.m_rct} }; ++output_no; - total_xmr += xmr_amount; + if (!is_output_spent) + { + total_xmr += xmr_amount; + } output_keys_ctx.push_back(output_info); } diff --git a/src/templates/checkrawoutputkeys.html b/src/templates/checkrawoutputkeys.html index 7e18680..3db3843 100644 --- a/src/templates/checkrawoutputkeys.html +++ b/src/templates/checkrawoutputkeys.html @@ -30,7 +30,7 @@

Output keys for address: {{address}}

Viewkey: {{viewkey}}

{{#has_total_xmr}} -

Total value of xmr received: {{total_xmr}}

+

Total xmr balance: {{total_xmr}}

{{/has_total_xmr}}
@@ -42,6 +42,7 @@ Public key Timestamp RingCT + Is spent? Amount {{#output_keys}} @@ -51,6 +52,13 @@ {{output_pub_key}} {{timestamp}} {{is_ringct}} + {{^is_spent}} + {{is_spent}} + {{/is_spent}} + {{#is_spent}} + {{is_spent}} + {{/is_spent}} + {{amount}}