added: output keys checker accounts for spend outputs

master
moneroexamples 8 years ago
parent 4a81039cf0
commit b9c1d2f098

@ -2538,18 +2538,26 @@ public:
uint64_t blk_timestamp = core_storage uint64_t blk_timestamp = core_storage
->get_db().get_block_timestamp(td.m_block_height); ->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 { mstch::map output_info {
{"output_no" , fmt::format("{:03d}", output_no)}, {"output_no" , fmt::format("{:03d}", output_no)},
{"output_pub_key" , REMOVE_HASH_BRAKETS(fmt::format("{:s}", txout_key.key))}, {"output_pub_key" , REMOVE_HASH_BRAKETS(fmt::format("{:s}", txout_key.key))},
{"amount" , xmreg::xmr_amount_to_str(xmr_amount)}, {"amount" , xmreg::xmr_amount_to_str(xmr_amount)},
{"tx_hash" , REMOVE_HASH_BRAKETS(fmt::format("{:s}", td.m_txid))}, {"tx_hash" , REMOVE_HASH_BRAKETS(fmt::format("{:s}", td.m_txid))},
{"timestamp" , xmreg::timestamp_to_str(blk_timestamp)}, {"timestamp" , xmreg::timestamp_to_str(blk_timestamp)},
{"is_spent" , is_output_spent},
{"is_ringct" , td.m_rct} {"is_ringct" , td.m_rct}
}; };
++output_no; ++output_no;
total_xmr += xmr_amount; if (!is_output_spent)
{
total_xmr += xmr_amount;
}
output_keys_ctx.push_back(output_info); output_keys_ctx.push_back(output_info);
} }

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

Loading…
Cancel
Save