mirror of
https://github.com/oxen-io/oxen-core.git
synced 2023-12-14 02:22:56 +01:00
Remove dumb configurable decimal place support
*Nothing* calls `print_money()` with a decimal place value, for good reason: it's a stupid thing to want to do. Similarly nothing gives a decimal places argument to `get_unit()`. This removes the dumb unused decimal place argument.
This commit is contained in:
parent
a3547c8467
commit
5330069421
|
@ -1047,36 +1047,12 @@ namespace cryptonote
|
|||
cn_fast_hash(blob.data(), blob.size(), res);
|
||||
}
|
||||
//---------------------------------------------------------------
|
||||
std::string get_unit(unsigned int decimal_point)
|
||||
std::string print_money(uint64_t amount)
|
||||
{
|
||||
if (decimal_point == (unsigned int)-1)
|
||||
decimal_point = CRYPTONOTE_DISPLAY_DECIMAL_POINT;
|
||||
switch (decimal_point)
|
||||
{
|
||||
case 9:
|
||||
return "oxen";
|
||||
case 6:
|
||||
return "megarok";
|
||||
case 3:
|
||||
return "kilorok";
|
||||
case 0:
|
||||
return "rok";
|
||||
default:
|
||||
ASSERT_MES_AND_THROW("Invalid decimal point specification: " << decimal_point);
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------
|
||||
std::string print_money(uint64_t amount, unsigned int decimal_point)
|
||||
{
|
||||
if (decimal_point == (unsigned int)-1)
|
||||
decimal_point = CRYPTONOTE_DISPLAY_DECIMAL_POINT;
|
||||
std::string s = std::to_string(amount);
|
||||
if(s.size() < decimal_point+1)
|
||||
{
|
||||
s.insert(0, decimal_point+1 - s.size(), '0');
|
||||
}
|
||||
if (decimal_point > 0)
|
||||
s.insert(s.size() - decimal_point, ".");
|
||||
std::string s = tools::int_to_string(amount);
|
||||
if (s.size() <= CRYPTONOTE_DISPLAY_DECIMAL_POINT)
|
||||
s.insert(0, CRYPTONOTE_DISPLAY_DECIMAL_POINT - s.size() + 1, '0');
|
||||
s.insert(s.size() - CRYPTONOTE_DISPLAY_DECIMAL_POINT, ".");
|
||||
return s;
|
||||
}
|
||||
//---------------------------------------------------------------
|
||||
|
|
|
@ -213,8 +213,8 @@ namespace cryptonote
|
|||
uint64_t get_block_height(const block& b);
|
||||
std::vector<uint64_t> relative_output_offsets_to_absolute(const std::vector<uint64_t>& off);
|
||||
std::vector<uint64_t> absolute_output_offsets_to_relative(const std::vector<uint64_t>& off);
|
||||
std::string get_unit(unsigned int decimal_point = -1);
|
||||
std::string print_money(uint64_t amount, unsigned int decimal_point = -1);
|
||||
inline constexpr std::string_view get_unit() { return "OXEN"sv; }
|
||||
std::string print_money(uint64_t amount);
|
||||
|
||||
std::string print_tx_verification_context (tx_verification_context const &tvc, transaction const *tx = nullptr);
|
||||
std::string print_vote_verification_context(vote_verification_context const &vvc, service_nodes::quorum_vote_t const *vote = nullptr);
|
||||
|
|
Loading…
Reference in a new issue