1
0
Fork 0
forked from lthn/blockchain

do not use burned coins for mixing in (anonymity improvement)

This commit is contained in:
sowle 2020-06-03 13:09:43 +03:00
parent 1e3c0cd396
commit eb8b3f30b7
No known key found for this signature in database
GPG key ID: C07A24B2D89D49FC

View file

@ -2363,6 +2363,7 @@ bool blockchain_storage::add_out_to_get_random_outs(COMMAND_RPC_GET_RANDOM_OUTPU
const transaction& tx = tx_ptr->tx;
CHECK_AND_ASSERT_MES(tx.vout[out_ptr->out_no].target.type() == typeid(txout_to_key), false, "unknown tx out type");
const txout_to_key& otk = boost::get<txout_to_key>(tx.vout[out_ptr->out_no].target);
CHECK_AND_ASSERT_MES(tx_ptr->m_spent_flags.size() == tx.vout.size(), false, "internal error");
@ -2370,12 +2371,16 @@ bool blockchain_storage::add_out_to_get_random_outs(COMMAND_RPC_GET_RANDOM_OUTPU
if (tx_ptr->m_spent_flags[out_ptr->out_no])
return false;
// do not use burned coins
if (otk.key == null_pkey)
return false;
//check if transaction is unlocked
if (!is_tx_spendtime_unlocked(get_tx_unlock_time(tx, out_ptr->out_no)))
return false;
//use appropriate mix_attr out
uint8_t mix_attr = boost::get<txout_to_key>(tx.vout[out_ptr->out_no].target).mix_attr;
uint8_t mix_attr = otk.mix_attr;
if(mix_attr == CURRENCY_TO_KEY_OUT_FORCED_NO_MIX)
return false; //COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS call means that ring signature will have more than one entry.
@ -2387,7 +2392,7 @@ bool blockchain_storage::add_out_to_get_random_outs(COMMAND_RPC_GET_RANDOM_OUTPU
COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::out_entry& oen = *result_outs.outs.insert(result_outs.outs.end(), COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::out_entry());
oen.global_amount_index = i;
oen.out_key = boost::get<txout_to_key>(tx.vout[out_ptr->out_no].target).key;
oen.out_key = otk.key;
return true;
}
//------------------------------------------------------------------