From 716b1c48d8289981dadc0ea96f441f35348736d8 Mon Sep 17 00:00:00 2001 From: MoneroOcean Date: Sun, 25 Mar 2018 14:37:01 +0200 Subject: [PATCH] Simplified code --- src/cryptonote_config.h | 16 +-------- .../cryptonote_format_utils.cpp | 35 ------------------- src/cryptonote_core/cryptonote_format_utils.h | 2 +- 3 files changed, 2 insertions(+), 51 deletions(-) diff --git a/src/cryptonote_config.h b/src/cryptonote_config.h index b8838fd..bbd70bf 100644 --- a/src/cryptonote_config.h +++ b/src/cryptonote_config.h @@ -1,20 +1,6 @@ #pragma once -#define CRYPTONOTE_PUBLIC_ADDRESS_TEXTBLOB_VER 0 -#define CURRENT_TRANSACTION_VERSION 1 -#define CURRENT_BLOCK_MAJOR_VERSION 1 -#define CURRENT_BLOCK_MINOR_VERSION 0 - -#define BLOCK_MAJOR_VERSION_1 1 -#define BLOCK_MAJOR_VERSION_2 2 -#define BLOCK_MAJOR_VERSION_3 3 - -#define COIN ((uint64_t)100000000) // pow(10, 8) -#define DEFAULT_FEE ((uint64_t)1000000) // pow(10, 6) - - -#define CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW 60 -#define CRYPTONOTE_DISPLAY_DECIMAL_POINT 12 +#define CURRENT_TRANSACTION_VERSION 1 enum BLOB_TYPE { BLOB_TYPE_CRYPTONOTE = 0, diff --git a/src/cryptonote_core/cryptonote_format_utils.cpp b/src/cryptonote_core/cryptonote_format_utils.cpp index c45d787..26d1fe3 100644 --- a/src/cryptonote_core/cryptonote_format_utils.cpp +++ b/src/cryptonote_core/cryptonote_format_utils.cpp @@ -80,41 +80,6 @@ namespace cryptonote return total; } //--------------------------------------------------------------- - bool parse_amount(uint64_t& amount, const std::string& str_amount_) - { - std::string str_amount = str_amount_; - boost::algorithm::trim(str_amount); - - size_t point_index = str_amount.find_first_of('.'); - size_t fraction_size; - if (std::string::npos != point_index) - { - fraction_size = str_amount.size() - point_index - 1; - while (CRYPTONOTE_DISPLAY_DECIMAL_POINT < fraction_size && '0' == str_amount.back()) - { - str_amount.erase(str_amount.size() - 1, 1); - --fraction_size; - } - if (CRYPTONOTE_DISPLAY_DECIMAL_POINT < fraction_size) - return false; - str_amount.erase(point_index, 1); - } - else - { - fraction_size = 0; - } - - if (str_amount.empty()) - return false; - - if (fraction_size < CRYPTONOTE_DISPLAY_DECIMAL_POINT) - { - str_amount.append(CRYPTONOTE_DISPLAY_DECIMAL_POINT - fraction_size, '0'); - } - - return string_tools::get_xtype_from_string(amount, str_amount); - } - //--------------------------------------------------------------- bool get_tx_fee(const transaction& tx, uint64_t & fee) { uint64_t amount_in = 0; diff --git a/src/cryptonote_core/cryptonote_format_utils.h b/src/cryptonote_core/cryptonote_format_utils.h index 16baed7..5295c43 100644 --- a/src/cryptonote_core/cryptonote_format_utils.h +++ b/src/cryptonote_core/cryptonote_format_utils.h @@ -95,7 +95,7 @@ namespace cryptonote uint64_t get_outs_money_amount(const transaction& tx); bool check_inputs_types_supported(const transaction& tx); bool check_outs_valid(const transaction& tx); - bool parse_amount(uint64_t& amount, const std::string& str_amount); + //bool parse_amount(uint64_t& amount, const std::string& str_amount); bool check_money_overflow(const transaction& tx); bool check_outs_overflow(const transaction& tx);