aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
diff options
context:
space:
mode:
authorThomas Winget <tewinget@gmail.com>2014-10-02 16:44:55 -0400
committerRiccardo Spagni <ric@spagni.net>2014-11-06 22:09:07 -0700
commit557e27fd2150953ce175ec123013faddcabcccde (patch)
treea89402f98540f93b7038294c5ad896d5033ecd6a /src/wallet
parentMerge pull request #182 (diff)
downloadmonero-557e27fd2150953ce175ec123013faddcabcccde.tar.xz
per kb fees
Diffstat (limited to 'src/wallet')
-rw-r--r--src/wallet/wallet2.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index 5af9a71bd..31345879b 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, 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"