fix: checking if key_image is spend only when td.m_key_image_known is True

master
moneroexamples 8 years ago
parent 79de75f172
commit a4c3def391

@ -2521,6 +2521,8 @@ public:
uint64_t total_xmr {0};
uint64_t output_no {0};
context["are_key_images_known"] = false;
for (const tools::wallet2::transfer_details& td: outputs)
{
@ -2573,9 +2575,20 @@ 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;
const key_image* output_key_img;
bool is_output_spent {false};
if (td.m_key_image_known)
{
//are_key_images_known
bool is_output_spent = core_storage->have_tx_keyimg_as_spent(output_key_img);
output_key_img = &td.m_key_image;
is_output_spent = core_storage->have_tx_keyimg_as_spent(*output_key_img);
context["are_key_images_known"] = true;
}
mstch::map output_info {
{"output_no" , fmt::format("{:03d}", output_no)},

@ -30,7 +30,7 @@
<h4>Key images for address: {{address}}</h4>
<h4>Viewkey: {{viewkey}}</h4>
{{#has_total_xmr}}
<h4>Total value of xmr spend: {{total_xmr}}</h4>
<h4>Total xmr: {{total_xmr}}</h4>
{{/has_total_xmr}}
<div class="center">

@ -30,7 +30,7 @@
<h4>Output keys for address: {{address}}</h4>
<h4>Viewkey: {{viewkey}}</h4>
{{#has_total_xmr}}
<h4>Total xmr balance: {{total_xmr}}</h4>
<h4>Total xmr: {{total_xmr}}</h4>
{{/has_total_xmr}}
<div class="center">
@ -42,7 +42,9 @@
<td>Public key</td>
<td>Timestamp</td>
<td>RingCT</td>
<td>Is spent?</td>
{{#are_key_images_known}}
<td>Is spent?</td>
{{/are_key_images_known}}
<td>Amount</td>
</tr>
{{#output_keys}}
@ -52,13 +54,15 @@
<td><a href="/tx/{{tx_hash}}">{{output_pub_key}}</a></td>
<td>{{timestamp}}</td>
<td>{{is_ringct}}</td>
<td>{{^is_spent}}
<span style="color: #008009;font-weight: bold">{{is_spent}}</span>
{{/is_spent}}
{{#is_spent}}
{{is_spent}}
{{/is_spent}}
</td>
{{#are_key_images_known}}
<td>{{^is_spent}}
<span style="color: #008009;font-weight: bold">{{is_spent}}</span>
{{/is_spent}}
{{#is_spent}}
{{is_spent}}
{{/is_spent}}
</td>
{{/are_key_images_known}}
<td>{{amount}}</td>
</tr>

Loading…
Cancel
Save