mirror of
https://github.com/monero-project/monero.git
synced 2025-08-18 03:50:22 -04:00
v8: per byte fee, pad bulletproofs, fixed 11 ring size
This commit is contained in:
parent
869b3bf824
commit
5ffb2ff9b7
55 changed files with 1241 additions and 878 deletions
|
@ -86,9 +86,9 @@ typedef cryptonote::simple_wallet sw;
|
|||
|
||||
#define EXTENDED_LOGS_FILE "wallet_details.log"
|
||||
|
||||
#define DEFAULT_MIX 6
|
||||
#define DEFAULT_MIX 10
|
||||
|
||||
#define MIN_RING_SIZE 7 // Used to inform user about min ring size -- does not track actual protocol
|
||||
#define MIN_RING_SIZE 11 // Used to inform user about min ring size -- does not track actual protocol
|
||||
|
||||
#define LOCK_IDLE_SCOPE() \
|
||||
bool auto_refresh_enabled = m_auto_refresh_enabled.load(std::memory_order_relaxed); \
|
||||
|
@ -829,21 +829,24 @@ bool simple_wallet::print_fee_info(const std::vector<std::string> &args/* = std:
|
|||
fail_msg_writer() << tr("Cannot connect to daemon");
|
||||
return true;
|
||||
}
|
||||
const uint64_t per_kb_fee = m_wallet->get_per_kb_fee();
|
||||
const uint64_t typical_size_kb = 13;
|
||||
message_writer() << (boost::format(tr("Current fee is %s %s per kB")) % print_money(per_kb_fee) % cryptonote::get_unit(cryptonote::get_default_decimal_point())).str();
|
||||
const bool per_byte = m_wallet->use_fork_rules(HF_VERSION_PER_BYTE_FEE);
|
||||
const uint64_t base_fee = m_wallet->get_base_fee();
|
||||
const char *base = per_byte ? "byte" : "kB";
|
||||
const uint64_t typical_size = per_byte ? 2500 : 13;
|
||||
const uint64_t size_granularity = per_byte ? 1 : 1024;
|
||||
message_writer() << (boost::format(tr("Current fee is %s %s per %s")) % print_money(base_fee) % cryptonote::get_unit(cryptonote::get_default_decimal_point()) % base).str();
|
||||
|
||||
std::vector<uint64_t> fees;
|
||||
for (uint32_t priority = 1; priority <= 4; ++priority)
|
||||
{
|
||||
uint64_t mult = m_wallet->get_fee_multiplier(priority);
|
||||
fees.push_back(per_kb_fee * typical_size_kb * mult);
|
||||
fees.push_back(base_fee * typical_size * mult);
|
||||
}
|
||||
std::vector<std::pair<uint64_t, uint64_t>> blocks;
|
||||
try
|
||||
{
|
||||
uint64_t base_size = typical_size_kb * 1024;
|
||||
blocks = m_wallet->estimate_backlog(base_size, base_size + 1023, fees);
|
||||
uint64_t base_size = typical_size * size_granularity;
|
||||
blocks = m_wallet->estimate_backlog(base_size, base_size + size_granularity - 1, fees);
|
||||
}
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
|
@ -1839,6 +1842,8 @@ bool simple_wallet::set_default_ring_size(const std::vector<std::string> &args/*
|
|||
|
||||
if (ring_size != 0 && ring_size != DEFAULT_MIX+1)
|
||||
message_writer() << tr("WARNING: this is a non default ring size, which may harm your privacy. Default is recommended.");
|
||||
else if (ring_size == DEFAULT_MIX)
|
||||
message_writer() << tr("WARNING: from v8, ring size will be fixed and this setting will be ignored.");
|
||||
|
||||
const auto pwd_container = get_and_verify_password();
|
||||
if (pwd_container)
|
||||
|
@ -4704,6 +4709,11 @@ bool simple_wallet::transfer_main(int transfer_type, const std::vector<std::stri
|
|||
fail_msg_writer() << (boost::format(tr("ring size %u is too small, minimum is %u")) % (fake_outs_count+1) % (adjusted_fake_outs_count+1)).str();
|
||||
return true;
|
||||
}
|
||||
if (adjusted_fake_outs_count < fake_outs_count)
|
||||
{
|
||||
fail_msg_writer() << (boost::format(tr("ring size %u is too large, maximum is %u")) % (fake_outs_count+1) % (adjusted_fake_outs_count+1)).str();
|
||||
return true;
|
||||
}
|
||||
|
||||
const size_t min_args = (transfer_type == TransferLocked) ? 3 : 2;
|
||||
if(local_args.size() < min_args)
|
||||
|
@ -5228,6 +5238,11 @@ bool simple_wallet::sweep_main(uint64_t below, bool locked, const std::vector<st
|
|||
fail_msg_writer() << (boost::format(tr("ring size %u is too small, minimum is %u")) % (fake_outs_count+1) % (adjusted_fake_outs_count+1)).str();
|
||||
return true;
|
||||
}
|
||||
if (adjusted_fake_outs_count < fake_outs_count)
|
||||
{
|
||||
fail_msg_writer() << (boost::format(tr("ring size %u is too large, maximum is %u")) % (fake_outs_count+1) % (adjusted_fake_outs_count+1)).str();
|
||||
return true;
|
||||
}
|
||||
|
||||
uint64_t unlock_block = 0;
|
||||
if (locked) {
|
||||
|
@ -5466,12 +5481,28 @@ bool simple_wallet::sweep_single(const std::vector<std::string> &args_)
|
|||
if (fake_outs_count == 0)
|
||||
fake_outs_count = DEFAULT_MIX;
|
||||
}
|
||||
else if (ring_size == 0)
|
||||
{
|
||||
fail_msg_writer() << tr("Ring size must not be 0");
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
fake_outs_count = ring_size - 1;
|
||||
local_args.erase(local_args.begin());
|
||||
}
|
||||
}
|
||||
uint64_t adjusted_fake_outs_count = m_wallet->adjust_mixin(fake_outs_count);
|
||||
if (adjusted_fake_outs_count > fake_outs_count)
|
||||
{
|
||||
fail_msg_writer() << (boost::format(tr("ring size %u is too small, minimum is %u")) % (fake_outs_count+1) % (adjusted_fake_outs_count+1)).str();
|
||||
return true;
|
||||
}
|
||||
if (adjusted_fake_outs_count < fake_outs_count)
|
||||
{
|
||||
fail_msg_writer() << (boost::format(tr("ring size %u is too large, maximum is %u")) % (fake_outs_count+1) % (adjusted_fake_outs_count+1)).str();
|
||||
return true;
|
||||
}
|
||||
|
||||
std::vector<uint8_t> extra;
|
||||
bool payment_id_seen = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue