mixins public keys added to api/transactions
This commit is contained in:
parent
de62e7486a
commit
39df8497e3
29
README.md
29
README.md
|
@ -226,19 +226,33 @@ The explorer has JSON api. For the API, it uses conventions defined by [JSend](h
|
||||||
curl -w "\n" -X GET "http://139.162.32.245:8081/api/transaction/6093260dbe79fd6277694d14789dc8718f1bd54457df8bab338c2efa3bb0f03d"
|
curl -w "\n" -X GET "http://139.162.32.245:8081/api/transaction/6093260dbe79fd6277694d14789dc8718f1bd54457df8bab338c2efa3bb0f03d"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Partial results shown:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"data": {
|
"data": {
|
||||||
"block_height": 1268252,
|
"block_height": 1268252,
|
||||||
"coinbase": 0,
|
"coinbase": false,
|
||||||
"confirmations": 1,
|
"confirmations": 1,
|
||||||
"fee": 12517785574,
|
"current_height": 1268253,
|
||||||
|
"extra": "01be23e277aed6b5f41f66b05244bf994c13108347366ec678ae16657f0fc3a22b",
|
||||||
"inputs": [
|
"inputs": [
|
||||||
{
|
{
|
||||||
"amount": 0,
|
"amount": 0,
|
||||||
"key_image": "67838fd0ffd79f13e735830d3ec60412aed59e53e1f997feb6f73d088b949611"
|
"key_image": "67838fd0ffd79f13e735830d3ec60412aed59e53e1f997feb6f73d088b949611",
|
||||||
|
"mixins": [
|
||||||
|
{
|
||||||
|
"block_no": 1238623,
|
||||||
|
"public_key": "0a5b853c55303c10e1326acfb085b9e246e088b1ccac7e37f7a810d46a28a914"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"block_no": 1246942,
|
||||||
|
"public_key": "527cf86f5abbfb006c970f7c6eb40493786d4751306f8985c6a43f98a88c0dff"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"mixin": 9,
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
"amount": 0,
|
"amount": 0,
|
||||||
|
@ -249,12 +263,17 @@ curl -w "\n" -X GET "http://139.162.32.245:8081/api/transaction/6093260dbe79fd6
|
||||||
"public_key": "e25f00fceb77af841d780b68647618812695b4ca6ebe338faba6e077f758ac30"
|
"public_key": "e25f00fceb77af841d780b68647618812695b4ca6ebe338faba6e077f758ac30"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"payment_id": "",
|
||||||
|
"payment_id8": "",
|
||||||
"rct_type": 1,
|
"rct_type": 1,
|
||||||
"size": 13323000000000000,
|
|
||||||
"timestamp": 1489753456,
|
"timestamp": 1489753456,
|
||||||
"timestamp_utc": "2017-03-17 12:24:16",
|
"timestamp_utc": "2017-03-17 12:24:16",
|
||||||
|
"tx_fee": 12517785574,
|
||||||
"tx_hash": "6093260dbe79fd6277694d14789dc8718f1bd54457df8bab338c2efa3bb0f03d",
|
"tx_hash": "6093260dbe79fd6277694d14789dc8718f1bd54457df8bab338c2efa3bb0f03d",
|
||||||
"version": 2
|
"tx_size": 13323,
|
||||||
|
"tx_version": 2,
|
||||||
|
"xmr_inputs": 0,
|
||||||
|
"xmr_outputs": 0
|
||||||
},
|
},
|
||||||
"status": "success"
|
"status": "success"
|
||||||
}
|
}
|
||||||
|
|
39
src/page.h
39
src/page.h
|
@ -3962,12 +3962,45 @@ namespace xmreg
|
||||||
|
|
||||||
json inputs;
|
json inputs;
|
||||||
|
|
||||||
for (const auto& input: txd.input_key_imgs)
|
for (const txin_to_key &in_key: txd.input_key_imgs)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// get absolute offsets of mixins
|
||||||
|
std::vector<uint64_t> absolute_offsets
|
||||||
|
= cryptonote::relative_output_offsets_to_absolute(
|
||||||
|
in_key.key_offsets);
|
||||||
|
|
||||||
|
// get public keys of outputs used in the mixins that match to the offests
|
||||||
|
std::vector<output_data_t> outputs;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
core_storage->get_db().get_output_key(in_key.amount,
|
||||||
|
absolute_offsets,
|
||||||
|
outputs);
|
||||||
|
}
|
||||||
|
catch (const OUTPUT_DNE &e)
|
||||||
|
{
|
||||||
|
j_response["status"] = "error";
|
||||||
|
j_response["message"] = "Failed to retrive outputs (mixins) used in key images";
|
||||||
|
return j_response;
|
||||||
|
}
|
||||||
|
|
||||||
inputs.push_back(json {
|
inputs.push_back(json {
|
||||||
{"key_image" , pod_to_hex(input.k_image)},
|
{"key_image" , pod_to_hex(in_key.k_image)},
|
||||||
{"amount" , input.amount}
|
{"amount" , in_key.amount},
|
||||||
|
{"mixins" , json {}}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
json& mixins = inputs.back()["mixins"];
|
||||||
|
|
||||||
|
for (const output_data_t& output_data: outputs)
|
||||||
|
{
|
||||||
|
mixins.push_back(json {
|
||||||
|
{"public_key" , pod_to_hex(output_data.pubkey)},
|
||||||
|
{"block_no" , output_data.height},
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (found_in_mempool == false)
|
if (found_in_mempool == false)
|
||||||
|
|
Loading…
Reference in New Issue