wallet: new transaction construction algorithm

It should avoid a lot of the issues sending more than half the
wallet's contents due to change.

Actual output selection is still random. Changing this would
improve the matching of transaction amounts to output sizes,
but may have non obvious effects on blockchain analysis.

Mapped to the new transfer_new command in simplewallet, and
transfer uses the existing algorithm.

To use in RPC, add "new_algorithm: true" in the transfer_split
JSON command. It is not used in the transfer command.
This commit is contained in:
moneromooo-monero 2015-07-19 23:47:13 +01:00
parent 1737fec297
commit 988fe1f843
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3
6 changed files with 438 additions and 5 deletions

View file

@ -254,7 +254,11 @@ namespace tools
try
{
std::vector<wallet2::pending_tx> ptx_vector = m_wallet.create_transactions(dsts, req.mixin, req.unlock_time, req.fee, extra);
std::vector<wallet2::pending_tx> ptx_vector;
if (req.new_algorithm)
ptx_vector = m_wallet.create_transactions_2(dsts, req.mixin, req.unlock_time, req.fee, extra);
else
ptx_vector = m_wallet.create_transactions(dsts, req.mixin, req.unlock_time, req.fee, extra);
m_wallet.commit_tx(ptx_vector);