showing tx extra added

master
moneroexamples 9 years ago
parent a8ad1e027d
commit 96dc29f804

@ -72,6 +72,7 @@ namespace xmreg {
uint64_t size; uint64_t size;
size_t version; size_t version;
uint64_t unlock_time; uint64_t unlock_time;
vector<uint8_t> extra;
crypto::hash payment_id = null_hash; // normal crypto::hash payment_id = null_hash; // normal
crypto::hash8 payment_id8 = null_hash8; // encrypted crypto::hash8 payment_id8 = null_hash8; // encrypted
@ -93,11 +94,14 @@ namespace xmreg {
string tx_pk_str = REMOVE_HASH_BRAKETS(fmt::format("{:s}", pk)); string tx_pk_str = REMOVE_HASH_BRAKETS(fmt::format("{:s}", pk));
cout << "payment_id: " << payment_id << endl; //cout << "payment_id: " << payment_id << endl;
string pid_str = REMOVE_HASH_BRAKETS(fmt::format("{:s}", payment_id)); string pid_str = REMOVE_HASH_BRAKETS(fmt::format("{:s}", payment_id));
string pid8_str = REMOVE_HASH_BRAKETS(fmt::format("{:s}", payment_id8)); string pid8_str = REMOVE_HASH_BRAKETS(fmt::format("{:s}", payment_id8));
//cout << "extra: " << extra_str << endl;
mstch::map txd_map { mstch::map txd_map {
{"hash" , tx_hash_str}, {"hash" , tx_hash_str},
{"pub_key" , tx_pk_str}, {"pub_key" , tx_pk_str},
@ -111,6 +115,7 @@ namespace xmreg {
{"has_payment_id" , payment_id != null_hash}, {"has_payment_id" , payment_id != null_hash},
{"has_payment_id8" , payment_id8 != null_hash8}, {"has_payment_id8" , payment_id8 != null_hash8},
{"payment_id" , pid_str}, {"payment_id" , pid_str},
{"extra" , get_extra_str()},
{"payment_id8" , pid8_str}, {"payment_id8" , pid8_str},
{"unlock_time" , std::to_string(unlock_time)}, {"unlock_time" , std::to_string(unlock_time)},
{"tx_size" , fmt::format("{:0.4f}", static_cast<double>(size)/1024.0)} {"tx_size" , fmt::format("{:0.4f}", static_cast<double>(size)/1024.0)}
@ -120,6 +125,17 @@ namespace xmreg {
return txd_map; return txd_map;
} }
string
get_extra_str()
{
string extra_str = epee::string_tools::buff_to_hex_nodelimer(
string{reinterpret_cast<const char*>(extra.data()), extra.size()});
return extra_str;
}
mstch::array mstch::array
get_ring_sig_for_input(uint64_t in_i) get_ring_sig_for_input(uint64_t in_i)
{ {
@ -729,6 +745,7 @@ namespace xmreg {
{"has_payment_id8" , txd.payment_id8 != null_hash8}, {"has_payment_id8" , txd.payment_id8 != null_hash8},
{"payment_id" , pid_str}, {"payment_id" , pid_str},
{"payment_id8" , pid8_str}, {"payment_id8" , pid8_str},
{"extra" , txd.get_extra_str()},
{"with_ring_signatures" , static_cast<bool>(with_ring_signatures)} {"with_ring_signatures" , static_cast<bool>(with_ring_signatures)}
}; };
@ -1072,6 +1089,8 @@ namespace xmreg {
txd.input_key_imgs = get_key_images(tx); txd.input_key_imgs = get_key_images(tx);
txd.output_pub_keys = get_ouputs(tx); txd.output_pub_keys = get_ouputs(tx);
txd.extra = tx.extra;
// get tx signatures for each input // get tx signatures for each input
txd.signatures = tx.signatures; txd.signatures = tx.signatures;

@ -32,6 +32,9 @@
<td>Fee: {{tx_fee}}</td> <td>Fee: {{tx_fee}}</td>
<td>Tx size: {{tx_size}} kB</td> <td>Tx size: {{tx_size}} kB</td>
</tr> </tr>
<tr>
<td colspan="5">Extra: {{extra}}</td>
</tr>
</table> </table>

Loading…
Cancel
Save