moneroexamples 7 years ago
parent fab2a28db0
commit 08a86df0bf

@ -182,6 +182,18 @@ MempoolStatus::read_mempool()
last_tx.txsize = fmt::format("{:0.2f}", last_tx.txsize = fmt::format("{:0.2f}",
static_cast<double>(_tx_info.blob_size)/1024.0); static_cast<double>(_tx_info.blob_size)/1024.0);
last_tx.pID = '-';
crypto::hash payment_id;
crypto::hash8 payment_id8;
get_payment_id(tx, payment_id, payment_id8);
if (payment_id != null_hash)
last_tx.pID = 'l'; // legacy payment id
else if (payment_id8 != null_hash8)
last_tx.pID = 'e'; // encrypted payment id
} // if (hex_to_pod(_tx_info.id_hash, mem_tx_hash)) } // if (hex_to_pod(_tx_info.id_hash, mem_tx_hash))
} // for (size_t i = 0; i < mempool_tx_info.size(); ++i) } // for (size_t i = 0; i < mempool_tx_info.size(); ++i)

@ -42,6 +42,10 @@ struct MempoolStatus
string xmr_outputs_str; string xmr_outputs_str;
string timestamp_str; string timestamp_str;
string txsize; string txsize;
char pID; // '-' - no payment ID,
// 'l' - legacy, long 64 character payment id,
// 'e' - encrypted, short, from integrated addresses
}; };

@ -134,6 +134,9 @@ namespace xmreg
uint64_t size; uint64_t size;
uint64_t blk_height; uint64_t blk_height;
size_t version; size_t version;
char pID; // '-' - no payment ID,
// 'l' - legacy, long 64 character payment id,
// 'e' - encrypted, short, from integrated addresses
uint64_t unlock_time; uint64_t unlock_time;
uint64_t no_confirmations; uint64_t no_confirmations;
vector<uint8_t> extra; vector<uint8_t> extra;
@ -188,6 +191,7 @@ namespace xmreg
{"version" , static_cast<uint64_t>(version)}, {"version" , static_cast<uint64_t>(version)},
{"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},
{"pID" , string {pID}},
{"payment_id" , pod_to_hex(payment_id)}, {"payment_id" , pod_to_hex(payment_id)},
{"confirmations" , no_confirmations}, {"confirmations" , no_confirmations},
{"extra" , get_extra_str()}, {"extra" , get_extra_str()},
@ -885,6 +889,7 @@ namespace xmreg
{"xmr_outputs" , mempool_tx.xmr_outputs_str}, {"xmr_outputs" , mempool_tx.xmr_outputs_str},
{"no_inputs" , mempool_tx.no_inputs}, {"no_inputs" , mempool_tx.no_inputs},
{"no_outputs" , mempool_tx.no_outputs}, {"no_outputs" , mempool_tx.no_outputs},
{"pID" , string {mempool_tx.pID}},
{"no_nonrct_inputs", mempool_tx.num_nonrct_inputs}, {"no_nonrct_inputs", mempool_tx.num_nonrct_inputs},
{"mixin" , mempool_tx.mixin_no}, {"mixin" , mempool_tx.mixin_no},
{"txsize" , mempool_tx.txsize} {"txsize" , mempool_tx.txsize}
@ -5739,6 +5744,8 @@ namespace xmreg
} }
} }
txd.pID = '-'; // no payment ID
get_payment_id(tx, txd.payment_id, txd.payment_id8); get_payment_id(tx, txd.payment_id, txd.payment_id8);
// get tx size in bytes // get tx size in bytes
@ -5749,6 +5756,11 @@ namespace xmreg
if (txd.payment_id != null_hash) if (txd.payment_id != null_hash)
{ {
txd.payment_id_as_ascii = std::string(txd.payment_id.data, crypto::HASH_SIZE); txd.payment_id_as_ascii = std::string(txd.payment_id.data, crypto::HASH_SIZE);
txd.pID = 'l'; // legacy payment id
}
else if (txd.payment_id8 != null_hash8)
{
txd.pID = 'e'; // encrypted payment id
} }
// get tx signatures for each input // get tx signatures for each input

@ -76,7 +76,7 @@
<td>tx hash</td> <td>tx hash</td>
<td>fees</td> <td>fees</td>
<td>outputs</td> <td>outputs</td>
<td>in(nonrct)/out</td> <td>in/out/pID</td>
<td>ring size</td> <td>ring size</td>
<td>tx size [kB]</td> <td>tx size [kB]</td>
</tr> </tr>
@ -88,7 +88,7 @@
<td><a href="/tx/{{hash}}">{{hash}}</a></td> <td><a href="/tx/{{hash}}">{{hash}}</a></td>
<td>{{tx_fee_short}}</td> <td>{{tx_fee_short}}</td>
<td>{{sum_outputs_short}}</td> <td>{{sum_outputs_short}}</td>
<td>{{no_inputs}}({{no_nonrct_inputs}})/{{no_outputs}}</td> <td>{{no_inputs}}/{{no_outputs}}/{{pID}}</td>
<td>{{mixin}}</td> <td>{{mixin}}</td>
<td>{{tx_size_short}}</td> <td>{{tx_size_short}}</td>
</tr> </tr>

@ -10,7 +10,7 @@
<td>transaction hash</td> <td>transaction hash</td>
<td>fee</td> <td>fee</td>
<td>outputs</td> <td>outputs</td>
<td>in(nonrct)/out</td> <td>in/out/pID</td>
<td>ring size</td> <td>ring size</td>
<td>tx size [kB]</td> <td>tx size [kB]</td>
</tr> </tr>
@ -20,7 +20,7 @@
<td><a href="/tx/{{hash}}">{{hash}}</a></td> <td><a href="/tx/{{hash}}">{{hash}}</a></td>
<td>{{fee}}</td> <td>{{fee}}</td>
<td>{{xmr_outputs}}</td> <td>{{xmr_outputs}}</td>
<td>{{no_inputs}}({{no_nonrct_inputs}})/{{no_outputs}}</td> <td>{{no_inputs}}/{{no_outputs}}/{{pID}}</td>
<td>{{mixin}}</td> <td>{{mixin}}</td>
<td>{{txsize}}</td> <td>{{txsize}}</td>
</tr> </tr>

@ -9,7 +9,7 @@
{{#has_payment_id}} {{#has_payment_id}}
<H5 style="margin:5px">Payment id: {{payment_id}}</H5> <H5 style="margin:5px">Payment id: {{payment_id}}</H5>
<H5 style="margin:5px">Payment id as ascii ([a-zA-Z0-9 /!]): {{payment_id_as_ascii}}</H5> <H5 style="margin:5px">Payment id as ascii: {{payment_id_as_ascii}}</H5>
{{/has_payment_id}} {{/has_payment_id}}
{{#has_payment_id8}} {{#has_payment_id8}}

Loading…
Cancel
Save