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)
This commit is contained in:
commit
2b93288fd7
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user