forked from lthn/blockchain
do not use burned coins for mixing in (anonymity improvement)
This commit is contained in:
parent
1e3c0cd396
commit
eb8b3f30b7
1 changed files with 7 additions and 2 deletions
|
|
@ -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;
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue