aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_basic
diff options
context:
space:
mode:
Diffstat (limited to 'src/cryptonote_basic')
-rw-r--r--src/cryptonote_basic/CMakeLists.txt1
-rw-r--r--src/cryptonote_basic/account.cpp6
-rw-r--r--src/cryptonote_basic/cryptonote_format_utils.cpp20
-rw-r--r--src/cryptonote_basic/cryptonote_format_utils.h2
-rw-r--r--src/cryptonote_basic/cryptonote_stat_info.h54
-rw-r--r--src/cryptonote_basic/verification_context.h1
6 files changed, 20 insertions, 64 deletions
diff --git a/src/cryptonote_basic/CMakeLists.txt b/src/cryptonote_basic/CMakeLists.txt
index 5bb56e083..59040d8a2 100644
--- a/src/cryptonote_basic/CMakeLists.txt
+++ b/src/cryptonote_basic/CMakeLists.txt
@@ -54,7 +54,6 @@ set(cryptonote_basic_private_headers
cryptonote_basic_impl.h
cryptonote_boost_serialization.h
cryptonote_format_utils.h
- cryptonote_stat_info.h
difficulty.h
hardfork.h
miner.h
diff --git a/src/cryptonote_basic/account.cpp b/src/cryptonote_basic/account.cpp
index a9aec163b..02eca289e 100644
--- a/src/cryptonote_basic/account.cpp
+++ b/src/cryptonote_basic/account.cpp
@@ -40,13 +40,11 @@ extern "C"
}
#include "cryptonote_basic_impl.h"
#include "cryptonote_format_utils.h"
+#include "cryptonote_config.h"
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "account"
-#define KEYS_ENCRYPTION_SALT 'k'
-
-
using namespace std;
DISABLE_VS_WARNINGS(4244 4345)
@@ -69,7 +67,7 @@ DISABLE_VS_WARNINGS(4244 4345)
static_assert(sizeof(base_key) == sizeof(crypto::hash), "chacha key and hash should be the same size");
epee::mlocked<tools::scrubbed_arr<char, sizeof(base_key)+1>> data;
memcpy(data.data(), &base_key, sizeof(base_key));
- data[sizeof(base_key)] = KEYS_ENCRYPTION_SALT;
+ data[sizeof(base_key)] = config::HASH_KEY_MEMORY;
crypto::generate_chacha_key(data.data(), sizeof(data), key, 1);
}
//-----------------------------------------------------------------
diff --git a/src/cryptonote_basic/cryptonote_format_utils.cpp b/src/cryptonote_basic/cryptonote_format_utils.cpp
index 138cf49f4..80747dd89 100644
--- a/src/cryptonote_basic/cryptonote_format_utils.cpp
+++ b/src/cryptonote_basic/cryptonote_format_utils.cpp
@@ -44,8 +44,6 @@ using namespace epee;
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "cn"
-#define ENCRYPTED_PAYMENT_ID_TAIL 0x8d
-
// #define ENABLE_HASH_CASH_INTEGRITY_CHECK
using namespace crypto;
@@ -996,17 +994,31 @@ namespace cryptonote
}
}
//---------------------------------------------------------------
- std::string print_money(uint64_t amount, unsigned int decimal_point)
+ static void insert_money_decimal_point(std::string &s, unsigned int decimal_point)
{
if (decimal_point == (unsigned int)-1)
decimal_point = default_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 print_money(uint64_t amount, unsigned int decimal_point)
+ {
+ std::string s = std::to_string(amount);
+ insert_money_decimal_point(s, decimal_point);
+ return s;
+ }
+ //---------------------------------------------------------------
+ std::string print_money(const boost::multiprecision::uint128_t &amount, unsigned int decimal_point)
+ {
+ std::stringstream ss;
+ ss << amount;
+ std::string s = ss.str();
+ insert_money_decimal_point(s, decimal_point);
return s;
}
//---------------------------------------------------------------
diff --git a/src/cryptonote_basic/cryptonote_format_utils.h b/src/cryptonote_basic/cryptonote_format_utils.h
index 29e4def64..8ed3b0b43 100644
--- a/src/cryptonote_basic/cryptonote_format_utils.h
+++ b/src/cryptonote_basic/cryptonote_format_utils.h
@@ -38,6 +38,7 @@
#include "crypto/crypto.h"
#include "crypto/hash.h"
#include <unordered_map>
+#include <boost/multiprecision/cpp_int.hpp>
namespace epee
{
@@ -139,6 +140,7 @@ namespace cryptonote
unsigned int get_default_decimal_point();
std::string get_unit(unsigned int decimal_point = -1);
std::string print_money(uint64_t amount, unsigned int decimal_point = -1);
+ std::string print_money(const boost::multiprecision::uint128_t &amount, unsigned int decimal_point = -1);
//---------------------------------------------------------------
template<class t_object>
bool t_serializable_object_from_blob(t_object& to, const blobdata& b_blob)
diff --git a/src/cryptonote_basic/cryptonote_stat_info.h b/src/cryptonote_basic/cryptonote_stat_info.h
deleted file mode 100644
index 4cc1bc764..000000000
--- a/src/cryptonote_basic/cryptonote_stat_info.h
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright (c) 2014-2019, The Monero Project
-//
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without modification, are
-// permitted provided that the following conditions are met:
-//
-// 1. Redistributions of source code must retain the above copyright notice, this list of
-// conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright notice, this list
-// of conditions and the following disclaimer in the documentation and/or other
-// materials provided with the distribution.
-//
-// 3. Neither the name of the copyright holder nor the names of its contributors may be
-// used to endorse or promote products derived from this software without specific
-// prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
-// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
-// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
-
-#pragma once
-#include "serialization/keyvalue_serialization.h"
-
-
-namespace cryptonote
-{
- struct core_stat_info_t
- {
- uint64_t tx_pool_size;
- uint64_t blockchain_height;
- uint64_t mining_speed;
- uint64_t alternative_blocks;
- std::string top_block_id_str;
-
- BEGIN_KV_SERIALIZE_MAP()
- KV_SERIALIZE(tx_pool_size)
- KV_SERIALIZE(blockchain_height)
- KV_SERIALIZE(mining_speed)
- KV_SERIALIZE(alternative_blocks)
- KV_SERIALIZE(top_block_id_str)
- END_KV_SERIALIZE_MAP()
- };
- typedef epee::misc_utils::struct_init<core_stat_info_t> core_stat_info;
-}
diff --git a/src/cryptonote_basic/verification_context.h b/src/cryptonote_basic/verification_context.h
index f5f663464..4d49b692c 100644
--- a/src/cryptonote_basic/verification_context.h
+++ b/src/cryptonote_basic/verification_context.h
@@ -47,7 +47,6 @@ namespace cryptonote
bool m_too_big;
bool m_overspend;
bool m_fee_too_low;
- bool m_not_rct;
bool m_too_few_outputs;
};