forked from lthn/blockchain
COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS adaptation and improvements
This commit is contained in:
parent
f0bbcb5f40
commit
30972db5ad
3 changed files with 11 additions and 7 deletions
|
|
@ -318,11 +318,13 @@ namespace currency
|
|||
struct request
|
||||
{
|
||||
std::list<uint64_t> amounts;
|
||||
uint64_t outs_count;
|
||||
uint64_t decoys_count; // how many decoy outputs needed (per amount)
|
||||
uint64_t height_upper_limit; // all the decoy outputs must be either older than, or the same age as this height
|
||||
bool use_forced_mix_outs;
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(amounts)
|
||||
KV_SERIALIZE(outs_count)
|
||||
KV_SERIALIZE(decoys_count)
|
||||
KV_SERIALIZE(height_upper_limit)
|
||||
KV_SERIALIZE(use_forced_mix_outs)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
|
|
@ -331,7 +333,9 @@ namespace currency
|
|||
struct out_entry
|
||||
{
|
||||
uint64_t global_amount_index;
|
||||
crypto::public_key out_key;
|
||||
crypto::public_key stealth_address;
|
||||
crypto::public_key concealing_point;
|
||||
crypto::public_key amount_commitment;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
|
|
|
|||
|
|
@ -4731,7 +4731,7 @@ bool wallet2::prepare_tx_sources(size_t fake_outputs_count, std::vector<currency
|
|||
{
|
||||
COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::request req = AUTO_VAL_INIT(req);
|
||||
req.use_forced_mix_outs = false; //add this feature to UI later
|
||||
req.outs_count = fake_outputs_count + 1;// add one to make possible (if need) to skip real output key
|
||||
req.decoys_count = fake_outputs_count + 1;// add one to make possible (if need) to skip real output key
|
||||
for (uint64_t i: selected_indicies)
|
||||
{
|
||||
auto it = m_transfers.begin() + i;
|
||||
|
|
@ -4751,7 +4751,7 @@ bool wallet2::prepare_tx_sources(size_t fake_outputs_count, std::vector<currency
|
|||
std::vector<COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::outs_for_amount> scanty_outs;
|
||||
for(COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::outs_for_amount& amount_outs : daemon_resp.outs)
|
||||
{
|
||||
if (amount_outs.outs.size() < req.outs_count)
|
||||
if (amount_outs.outs.size() < req.decoys_count)
|
||||
{
|
||||
scanty_outs.push_back(amount_outs);
|
||||
}
|
||||
|
|
@ -5980,7 +5980,7 @@ void wallet2::sweep_below(size_t fake_outs_count, const currency::account_public
|
|||
{
|
||||
COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::request req = AUTO_VAL_INIT(req);
|
||||
req.use_forced_mix_outs = false;
|
||||
req.outs_count = fake_outs_count + 1;
|
||||
req.decoys_count = fake_outs_count + 1;
|
||||
for (uint64_t i : selected_transfers)
|
||||
req.amounts.push_back(m_transfers[i].amount());
|
||||
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ bool get_random_outs_test::check_get_rand_outs(currency::core& c, size_t ev_inde
|
|||
{
|
||||
currency::COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::request req = AUTO_VAL_INIT(req);
|
||||
req.amounts.push_back(m_amount);
|
||||
req.outs_count = 4;
|
||||
req.decoys_count = 4;
|
||||
req.use_forced_mix_outs = false;
|
||||
currency::COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::response res = AUTO_VAL_INIT(res);
|
||||
c.get_blockchain_storage().get_random_outs_for_amounts(req, res);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue