diff options
author | Riccardo Spagni <ric@spagni.net> | 2014-11-06 22:11:39 -0700 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2014-11-06 22:11:49 -0700 |
commit | 2b93288fd717bbe5ebf046dd45000aee8cb3da46 (patch) | |
tree | 43c531fd7e22f46ac9759db77144d09e0fda6937 /src/wallet/wallet2.cpp | |
parent | Merge pull request #182 (diff) | |
parent | per kb fees not passing correct fee to transfer() (diff) | |
download | monero-2b93288fd717bbe5ebf046dd45000aee8cb3da46.tar.xz |
Merge pull request #184
d2287d3 per kb fees not passing correct fee to transfer() (Thomas Winget)
dc67b12 Should now properly do per-kb fee (Thomas Winget)
557e27f per kb fees (Thomas Winget)
Diffstat (limited to '')
-rw-r--r-- | src/wallet/wallet2.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 5af9a71bd..5b247ff47 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -954,7 +954,22 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions(std::vector<crypto { cryptonote::transaction tx; pending_tx ptx; - transfer(dst_vector, fake_outs_count, unlock_time, fee, extra, tx, ptx); + + // loop until fee is met without increasing tx size to next KB boundary. + uint64_t needed_fee = 0; + do + { + transfer(dst_vector, fake_outs_count, unlock_time, needed_fee, extra, tx, ptx); + auto txBlob = t_serializable_object_to_blob(ptx.tx); + uint64_t txSize = txBlob.size(); + uint64_t numKB = txSize / 1024; + if (txSize % 1024) + { + numKB++; + } + needed_fee = numKB * FEE_PER_KB; + } while (ptx.fee < needed_fee); + ptx_vector.push_back(ptx); // mark transfers to be used as "spent" |