added: output keys checker accounts for spend outputs

This commit is contained in:
moneroexamples 2016-12-01 09:11:31 +08:00
parent 4a81039cf0
commit b9c1d2f098
2 changed files with 18 additions and 2 deletions

View File

@ -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);
}

View File

@ -30,7 +30,7 @@
<h4>Output keys for address: {{address}}</h4>
<h4>Viewkey: {{viewkey}}</h4>
{{#has_total_xmr}}
<h4>Total value of xmr received: {{total_xmr}}</h4>
<h4>Total xmr balance: {{total_xmr}}</h4>
{{/has_total_xmr}}
<div class="center">
@ -42,6 +42,7 @@
<td>Public key</td>
<td>Timestamp</td>
<td>RingCT</td>
<td>Is spent?</td>
<td>Amount</td>
</tr>
{{#output_keys}}
@ -51,6 +52,13 @@
<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>
<td>{{amount}}</td>
</tr>