mirror of
https://git.wownero.com/wownero/onion-wownero-blockchain-explorer.git
synced 2024-08-15 00:33:12 +00:00
use only first output matched in an input to estimate spending
sometimes there can be two or more our outputs found in a single input. In this case, one is real spending, and the others are used as fakes. In this case, choose the first output found for spending estimation. Without spendkey it is impossible to know which one is real or fake for sure.
This commit is contained in:
parent
0a73be07b0
commit
4861cf5d6f
1 changed files with 38 additions and 15 deletions
29
src/page.h
29
src/page.h
|
@ -1270,6 +1270,16 @@ public:
|
||||||
// mixin counter
|
// mixin counter
|
||||||
size_t count = 0;
|
size_t count = 0;
|
||||||
|
|
||||||
|
// there can be more than one our output used for mixin in a single
|
||||||
|
// input. For example, if two outputs are matched (marked by *) in html,
|
||||||
|
// one of them will be our real spending, and second will be used as a fake
|
||||||
|
// one. ideally, to determine which is which, spendkey is required.
|
||||||
|
// obvisouly we dont have it here, so we need to pick one in other way.
|
||||||
|
// for now I will just pick the first one we find, and threat it as the
|
||||||
|
// real spending output. The no_of_output_matches_found variable
|
||||||
|
// is used for this purporse.
|
||||||
|
size_t no_of_output_matches_found {0};
|
||||||
|
|
||||||
// for each found output public key check if its ours or not
|
// for each found output public key check if its ours or not
|
||||||
for (const uint64_t& abs_offset: absolute_offsets)
|
for (const uint64_t& abs_offset: absolute_offsets)
|
||||||
{
|
{
|
||||||
|
@ -1430,6 +1440,13 @@ public:
|
||||||
} // if (mine_output && mixin_tx.version == 2)
|
} // if (mine_output && mixin_tx.version == 2)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// makre only
|
||||||
|
bool output_match = (txout_k.key == output_data.pubkey);
|
||||||
|
|
||||||
|
// mark only first output_match as the "real" one
|
||||||
|
// due to luck of better method of gussing which output
|
||||||
|
// is real if two are found in a single input.
|
||||||
|
output_match = output_match && no_of_output_matches_found == 0;
|
||||||
|
|
||||||
// save our mixnin's public keys
|
// save our mixnin's public keys
|
||||||
found_outputs.push_back(mstch::map {
|
found_outputs.push_back(mstch::map {
|
||||||
|
@ -1438,7 +1455,7 @@ public:
|
||||||
{"mine_output" , mine_output},
|
{"mine_output" , mine_output},
|
||||||
{"out_idx" , to_string(output_idx_in_tx)},
|
{"out_idx" , to_string(output_idx_in_tx)},
|
||||||
{"formed_output_pk", out_pub_key_str},
|
{"formed_output_pk", out_pub_key_str},
|
||||||
{"out_in_match" , (txout_k.key == output_data.pubkey)},
|
{"out_in_match" , output_match},
|
||||||
{"amount" , xmreg::xmr_amount_to_str(amount)}
|
{"amount" , xmreg::xmr_amount_to_str(amount)}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1459,8 +1476,9 @@ public:
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
no_of_matched_mixins++;
|
// sum up only first output matched found in each input
|
||||||
|
if (no_of_output_matches_found == 0)
|
||||||
|
{
|
||||||
// for regular txs, just concentrated on outputs
|
// for regular txs, just concentrated on outputs
|
||||||
// which have same amount as the key image.
|
// which have same amount as the key image.
|
||||||
// for ringct its not possible to know for sure amount
|
// for ringct its not possible to know for sure amount
|
||||||
|
@ -1476,6 +1494,11 @@ public:
|
||||||
sum_mixin_xmr += amount;
|
sum_mixin_xmr += amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
no_of_matched_mixins++;
|
||||||
|
}
|
||||||
|
|
||||||
|
no_of_output_matches_found++;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // for (const pair<txout_to_key, uint64_t>& mix_out: txd.output_pub_keys)
|
} // for (const pair<txout_to_key, uint64_t>& mix_out: txd.output_pub_keys)
|
||||||
|
|
Loading…
Reference in a new issue