Simplified code
This commit is contained in:
@@ -1,20 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define CRYPTONOTE_PUBLIC_ADDRESS_TEXTBLOB_VER 0
|
#define CURRENT_TRANSACTION_VERSION 1
|
||||||
#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
|
|
||||||
|
|
||||||
enum BLOB_TYPE {
|
enum BLOB_TYPE {
|
||||||
BLOB_TYPE_CRYPTONOTE = 0,
|
BLOB_TYPE_CRYPTONOTE = 0,
|
||||||
|
|||||||
@@ -80,41 +80,6 @@ namespace cryptonote
|
|||||||
return total;
|
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)
|
bool get_tx_fee(const transaction& tx, uint64_t & fee)
|
||||||
{
|
{
|
||||||
uint64_t amount_in = 0;
|
uint64_t amount_in = 0;
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ namespace cryptonote
|
|||||||
uint64_t get_outs_money_amount(const transaction& tx);
|
uint64_t get_outs_money_amount(const transaction& tx);
|
||||||
bool check_inputs_types_supported(const transaction& tx);
|
bool check_inputs_types_supported(const transaction& tx);
|
||||||
bool check_outs_valid(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_money_overflow(const transaction& tx);
|
||||||
bool check_outs_overflow(const transaction& tx);
|
bool check_outs_overflow(const transaction& tx);
|
||||||
|
|||||||
Reference in New Issue
Block a user