Remove DEFAULT_FEE, add temporary acceptance of too-small per-kb fee >= 0.1, denominations based on DEFAULT_DUST_THRESHOLD, document fee arg to create_transactions as unused, se DEFAULT_DUST_THRESHOLD for wallet dust collection instead of calcualted tx fee
This commit is contained in:
parent
2b93288fd7
commit
cc74b43651
5 changed files with 10 additions and 9 deletions
|
@ -56,9 +56,11 @@
|
|||
#define CRYPTONOTE_DISPLAY_DECIMAL_POINT 12
|
||||
// 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)
|
||||
|
||||
// temporarily to allow backward compatibility during the switch to per-kb
|
||||
#define MINING_ALLOWED_LEGACY_FEE ((uint64_t)100000000000) // pow(10, 11)
|
||||
|
||||
#define ORPHANED_BLOCKS_MAX_COUNT 100
|
||||
|
||||
|
@ -115,7 +117,7 @@ namespace config
|
|||
{
|
||||
uint64_t const DEFAULT_FEE_ATOMIC_XMR_PER_KB = 500; // Just a placeholder! Change me!
|
||||
uint8_t const FEE_CALCULATION_MAX_RETRIES = 10;
|
||||
uint64_t const DEFAULT_DUST_THRESHOLD = 5000000000; // 5 * 10^9
|
||||
uint64_t const DEFAULT_DUST_THRESHOLD = ((uint64_t)10000000000); // pow(10, 10)
|
||||
std::string const P2P_REMOTE_DEBUG_TRUSTED_PUB_KEY = "0000000000000000000000000000000000000000000000000000000000000000";
|
||||
|
||||
uint64_t const CRYPTONOTE_PUBLIC_ADDRESS_BASE58_PREFIX = 18;
|
||||
|
|
|
@ -107,7 +107,7 @@ namespace cryptonote
|
|||
block_reward += fee;
|
||||
|
||||
std::vector<uint64_t> out_amounts;
|
||||
decompose_amount_into_digits(block_reward, DEFAULT_FEE,
|
||||
decompose_amount_into_digits(block_reward, ::config::DEFAULT_DUST_THRESHOLD,
|
||||
[&out_amounts](uint64_t a_chunk) { out_amounts.push_back(a_chunk); },
|
||||
[&out_amounts](uint64_t a_dust) { out_amounts.push_back(a_dust); });
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ namespace cryptonote
|
|||
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)
|
||||
if (!kept_by_block && fee < needed_fee && fee < MINING_ALLOWED_LEGACY_FEE)
|
||||
{
|
||||
LOG_PRINT_L1("transaction fee is not enough: " << print_money(fee) << ", minumim fee: " << print_money(needed_fee));
|
||||
tvc.m_verifivation_failed = true;
|
||||
|
|
|
@ -1054,15 +1054,14 @@ bool simple_wallet::transfer(const std::vector<std::string> &args_)
|
|||
try
|
||||
{
|
||||
// figure out what tx will be necessary
|
||||
auto ptx_vector = m_wallet->create_transactions(dsts, fake_outs_count, 0 /* unlock_time */, DEFAULT_FEE, extra);
|
||||
auto ptx_vector = m_wallet->create_transactions(dsts, fake_outs_count, 0 /* unlock_time */, 0 /* unused fee arg*/, extra);
|
||||
|
||||
// if more than one tx necessary, prompt user to confirm
|
||||
if (ptx_vector.size() > 1)
|
||||
{
|
||||
std::string prompt_str = "Your transaction needs to be split into ";
|
||||
prompt_str += std::to_string(ptx_vector.size());
|
||||
prompt_str += " transactions. This will result in a fee of ";
|
||||
prompt_str += print_money(ptx_vector.size() * DEFAULT_FEE);
|
||||
prompt_str += " transactions. This will result in a transaction fee being applied to each transaction";
|
||||
prompt_str += ". Is this okay? (Y/Yes/N/No)";
|
||||
std::string accepted = command_line::input_line(prompt_str);
|
||||
if (accepted != "Y" && accepted != "y" && accepted != "Yes" && accepted != "yes")
|
||||
|
|
|
@ -764,7 +764,7 @@ void wallet2::add_unconfirmed_tx(const cryptonote::transaction& tx, uint64_t cha
|
|||
void wallet2::transfer(const std::vector<cryptonote::tx_destination_entry>& dsts, size_t fake_outputs_count,
|
||||
uint64_t unlock_time, uint64_t fee, const std::vector<uint8_t>& extra, cryptonote::transaction& tx, pending_tx& ptx)
|
||||
{
|
||||
transfer(dsts, fake_outputs_count, unlock_time, fee, extra, detail::digit_split_strategy, tx_dust_policy(fee), tx, ptx);
|
||||
transfer(dsts, fake_outputs_count, unlock_time, fee, extra, detail::digit_split_strategy, tx_dust_policy(::config::DEFAULT_DUST_THRESHOLD), tx, ptx);
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
void wallet2::transfer(const std::vector<cryptonote::tx_destination_entry>& dsts, size_t fake_outputs_count,
|
||||
|
@ -930,7 +930,7 @@ void wallet2::commit_tx(std::vector<pending_tx>& ptx_vector)
|
|||
//
|
||||
// this function will make multiple calls to wallet2::transfer if multiple
|
||||
// transactions will be required
|
||||
std::vector<wallet2::pending_tx> wallet2::create_transactions(std::vector<cryptonote::tx_destination_entry> dsts, const size_t fake_outs_count, const uint64_t unlock_time, const uint64_t fee, const std::vector<uint8_t> extra)
|
||||
std::vector<wallet2::pending_tx> wallet2::create_transactions(std::vector<cryptonote::tx_destination_entry> dsts, const size_t fake_outs_count, const uint64_t unlock_time, const uint64_t fee_UNUSED, const std::vector<uint8_t> extra)
|
||||
{
|
||||
|
||||
// failsafe split attempt counter
|
||||
|
|
Loading…
Reference in a new issue