From 557e27fd2150953ce175ec123013faddcabcccde Mon Sep 17 00:00:00 2001 From: Thomas Winget Date: Thu, 2 Oct 2014 16:44:55 -0400 Subject: [PATCH 1/3] per kb fees --- src/cryptonote_config.h | 1 + src/cryptonote_core/tx_pool.cpp | 7 +++++-- src/wallet/wallet2.cpp | 17 ++++++++++++++++- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/cryptonote_config.h b/src/cryptonote_config.h index 1ac8ab328..fd52f2e87 100644 --- a/src/cryptonote_config.h +++ b/src/cryptonote_config.h @@ -57,6 +57,7 @@ // COIN - number of smallest units in one coin #define COIN ((uint64_t)1000000000000) // pow(10, 12) #define DEFAULT_FEE ((uint64_t)100000000000) // 5 * pow(10, 11) +#define FEE_PER_KB ((uint64_t)10000000000) // pow(10, 10) #define ORPHANED_BLOCKS_MAX_COUNT 100 diff --git a/src/cryptonote_core/tx_pool.cpp b/src/cryptonote_core/tx_pool.cpp index 81f932014..f623037ee 100644 --- a/src/cryptonote_core/tx_pool.cpp +++ b/src/cryptonote_core/tx_pool.cpp @@ -86,9 +86,12 @@ namespace cryptonote } uint64_t fee = inputs_amount - outputs_amount; - if (!kept_by_block && fee < DEFAULT_FEE) + uint64_t needed_fee = blob_size / 1024; + needed_fee += (blob_size % 1024) ? 1 : 0; + needed_fee *= FEE_PER_KB; + if (!kept_by_block && fee < needed_fee) { - LOG_PRINT_L1("transaction fee is not enough: " << print_money(fee) << ", minumim fee: " << print_money(DEFAULT_FEE)); + LOG_PRINT_L1("transaction fee is not enough: " << print_money(fee) << ", minumim fee: " << print_money(needed_fee)); tvc.m_verifivation_failed = true; return false; } 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::create_transactions(std::vector Date: Thu, 30 Oct 2014 18:53:56 -0400 Subject: [PATCH 2/3] Should now properly do per-kb fee I'm an idiot. --- src/wallet/wallet2.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 31345879b..173321d42 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -957,9 +957,10 @@ std::vector wallet2::create_transactions(std::vector Date: Mon, 3 Nov 2014 14:35:48 -0500 Subject: [PATCH 3/3] per kb fees not passing correct fee to transfer() --- src/wallet/wallet2.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 173321d42..5b247ff47 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -957,10 +957,9 @@ std::vector wallet2::create_transactions(std::vector