amount added to raw key images file info

master
moneroexamples 8 years ago
parent 00965a473f
commit 14f85fa45c

@ -2078,9 +2078,11 @@ namespace xmreg {
{"key_no" , fmt::format("{:03d}", n)}, {"key_no" , fmt::format("{:03d}", n)},
{"key_image" , REMOVE_HASH_BRAKETS(fmt::format("{:s}", key_image))}, {"key_image" , REMOVE_HASH_BRAKETS(fmt::format("{:s}", key_image))},
{"signature" , fmt::format("{:s}", signature)}, {"signature" , fmt::format("{:s}", signature)},
{"address" , xmreg::print_address(*xmr_address, testnet)},
{"amount" , string{}},
{"is_spent" , core_storage->have_tx_keyimg_as_spent(key_image)}, {"is_spent" , core_storage->have_tx_keyimg_as_spent(key_image)},
{"tx_hash_found" , !found_tx_hashes.empty()}, {"tx_hash_found" , !found_tx_hashes.empty()},
{"tx_hash" , string{}}, {"tx_hash" , string{}}
}; };
@ -2090,7 +2092,7 @@ namespace xmreg {
string tx_hash_str = found_tx_hashes.at(0); string tx_hash_str = found_tx_hashes.at(0);
key_img_info["tx_hash"] = tx_hash_str; key_img_info["tx_hash"] = tx_hash_str;
key_img_info["timestamp"] = "0"; key_img_info["timestamp"] = "";
transaction tx; transaction tx;
@ -2107,6 +2109,18 @@ namespace xmreg {
uint64_t blk_timestamp = core_storage uint64_t blk_timestamp = core_storage
->get_db().get_block_timestamp(blk_height); ->get_db().get_block_timestamp(blk_height);
vector<txin_to_key> tx_key_imgs = get_key_images(tx);
const vector<txin_to_key>::const_iterator it = find_if(tx_key_imgs.begin(), tx_key_imgs.end(), [&](txin_to_key tx_in)
{
return tx_in.k_image == key_image;
});
if (it != tx_key_imgs.end())
{
key_img_info["amount"] = fmt::format("{:0.12f}", XMR_AMOUNT((*it).amount));
}
key_img_info["timestamp"] = xmreg::timestamp_to_str(blk_timestamp); key_img_info["timestamp"] = xmreg::timestamp_to_str(blk_timestamp);
} }
} }

@ -31,6 +31,7 @@
<td>Key no.</td> <td>Key no.</td>
<td>Key image</td> <td>Key image</td>
<td>Timestamp</td> <td>Timestamp</td>
<td>Amount</td>
<td>Is spent?</td> <td>Is spent?</td>
</tr> </tr>
{{#key_imgs}} {{#key_imgs}}
@ -46,6 +47,7 @@
{{/tx_hash_found}} {{/tx_hash_found}}
</td> </td>
<td>{{timestamp}}</td> <td>{{timestamp}}</td>
<td>{{amount}}</td>
<td> <td>
{{#is_spent}} {{#is_spent}}
<span style="color: #008009;font-weight: bold">{{is_spent}}</span> <span style="color: #008009;font-weight: bold">{{is_spent}}</span>

@ -97,7 +97,7 @@
Send {{dest_amount}} to {{dest_address}}<br/> Send {{dest_amount}} to {{dest_address}}<br/>
{{/is_this_change}} {{/is_this_change}}
{{#is_this_change}} {{#is_this_change}}
Change {{dest_amount}} back to {{dest_address}}<br/> Total change {{dest_amount}} back to {{dest_address}}<br/>
{{/is_this_change}} {{/is_this_change}}
{{/dest_infos}} {{/dest_infos}}
</h5> </h5>

Loading…
Cancel
Save