wallet2: try to split dust sweep txs exponentially

This ensures even massive wallets full of dust can sweep.
This commit is contained in:
moneromooo-monero 2015-06-17 21:31:16 +01:00
parent f43f0660aa
commit 7c8d3be656
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3

View file

@ -1357,13 +1357,14 @@ std::vector<wallet2::pending_tx> wallet2::create_dust_sweep_transactions()
for(attempt_count = 1; ;attempt_count++) for(attempt_count = 1; ;attempt_count++)
{ {
size_t num_outputs_per_tx = (num_dust_outputs + attempt_count - 1) / attempt_count; size_t num_tx = 0.5 + pow(1.7,attempt_count-1);
size_t num_outputs_per_tx = (num_dust_outputs + num_tx - 1) / num_tx;
std::vector<pending_tx> ptx_vector; std::vector<pending_tx> ptx_vector;
try try
{ {
// for each new tx // for each new tx
for (size_t i=0; i<attempt_count;++i) for (size_t i=0; i<num_tx;++i)
{ {
cryptonote::transaction tx; cryptonote::transaction tx;
pending_tx ptx; pending_tx ptx;