Browse Source

Added cn utils lib.

cn_merge
Jianping Wu 6 years ago
parent
commit
4f74153e56
  1. 19
      src/Makefile.am
  2. 1
      src/Makefile.bench.include
  3. 4
      src/Makefile.qt.include
  4. 2
      src/Makefile.qttest.include
  5. 3
      src/Makefile.test.include
  6. 2
      src/cn_utils/contrib/epee/include/storages/portable_storage_val_converters.h
  7. 2
      src/cn_utils/crypto/chacha8.c
  8. 2
      src/cn_utils/crypto/crypto-ops.c
  9. 2
      src/cn_utils/crypto/crypto.cpp
  10. 2
      src/cn_utils/crypto/hash-ops.h
  11. 2
      src/cn_utils/cryptonote_core/account.cpp
  12. 2
      src/cn_utils/cryptonote_core/blockchain_storage.cpp
  13. 10
      src/cn_utils/cryptonote_core/cryptonote_core.cpp
  14. 2
      src/cn_utils/cryptonote_core/cryptonote_core.h
  15. 2
      src/cn_utils/cryptonote_core/tx_pool.cpp
  16. 4
      src/cn_utils/cryptonote_protocol/cryptonote_protocol_handler.h
  17. 4
      src/cn_utils/p2p/net_node.h
  18. 2
      src/cn_utils/serialization/binary_archive.h

19
src/Makefile.am

@ -28,6 +28,7 @@ LIBBITCOIN_COMMON=libbitcoin_common.a @@ -28,6 +28,7 @@ LIBBITCOIN_COMMON=libbitcoin_common.a
LIBBITCOIN_CONSENSUS=libbitcoin_consensus.a
LIBBITCOIN_CLI=libbitcoin_cli.a
LIBBITCOIN_UTIL=libbitcoin_util.a
LIBBITCOIN_CNUTILS=libbitcoin_cnutils.a
LIBBITCOIN_CRYPTO=crypto/libbitcoin_crypto.a
LIBBITCOINQT=qt/libbitcoinqt.a
LIBSECP256K1=secp256k1/libsecp256k1.la
@ -50,6 +51,7 @@ $(LIBSECP256K1): $(wildcard secp256k1/src/*) $(wildcard secp256k1/include/*) @@ -50,6 +51,7 @@ $(LIBSECP256K1): $(wildcard secp256k1/src/*) $(wildcard secp256k1/include/*)
EXTRA_LIBRARIES += \
$(LIBBITCOIN_CRYPTO) \
$(LIBBITCOIN_UTIL) \
$(LIBBITCOIN_CNUTILS) \
$(LIBBITCOIN_COMMON) \
$(LIBBITCOIN_CONSENSUS) \
$(LIBBITCOIN_SERVER) \
@ -366,6 +368,20 @@ libbitcoin_common_a_SOURCES = \ @@ -366,6 +368,20 @@ libbitcoin_common_a_SOURCES = \
keva/common.cpp \
$(BITCOIN_CORE_H)
# cnutils: shared between bitcoind, and bitcoin-qt and non-server tools
libbitcoin_cnutils_a_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/cn_utils -I$(srcdir)/cn_utils/contrib -I$(srcdir)/cn_utils/contrib/epee/include
libbitcoin_cnutils_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
libbitcoin_cnutils_a_SOURCES = \
cn_utils/cnutils.cpp \
cn_utils/cryptonote_core/cryptonote_format_utils.cpp \
cn_utils/crypto/tree-hash.c \
cn_utils/crypto/crypto.cpp \
cn_utils/crypto/crypto-ops.c \
cn_utils/crypto/crypto-ops-data.c \
cn_utils/crypto/hash.c \
cn_utils/crypto/keccak.c \
cn_utils/common/base58.cpp
# util: shared between all executables.
# This library *must* be included to make sure that the glibc
# backward-compatibility objects and their sanity checks are linked.
@ -420,6 +436,7 @@ kevacoind_LDADD = \ @@ -420,6 +436,7 @@ kevacoind_LDADD = \
$(LIBBITCOIN_COMMON) \
$(LIBUNIVALUE) \
$(LIBBITCOIN_UTIL) \
$(LIBBITCOIN_CNUTILS) \
$(LIBBITCOIN_WALLET) \
$(LIBBITCOIN_ZMQ) \
$(LIBBITCOIN_CONSENSUS) \
@ -445,6 +462,7 @@ kevacoin_cli_LDADD = \ @@ -445,6 +462,7 @@ kevacoin_cli_LDADD = \
$(LIBBITCOIN_CLI) \
$(LIBUNIVALUE) \
$(LIBBITCOIN_UTIL) \
$(LIBBITCOIN_CNUTILS) \
$(LIBBITCOIN_CRYPTO)
kevacoin_cli_LDADD += $(BOOST_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(EVENT_LIBS)
@ -464,6 +482,7 @@ kevacoin_tx_LDADD = \ @@ -464,6 +482,7 @@ kevacoin_tx_LDADD = \
$(LIBUNIVALUE) \
$(LIBBITCOIN_COMMON) \
$(LIBBITCOIN_UTIL) \
$(LIBBITCOIN_CNUTILS) \
$(LIBBITCOIN_CONSENSUS) \
$(LIBBITCOIN_CRYPTO) \
$(LIBSECP256K1)

1
src/Makefile.bench.include

@ -37,6 +37,7 @@ bench_bench_kevacoin_LDADD = \ @@ -37,6 +37,7 @@ bench_bench_kevacoin_LDADD = \
$(LIBBITCOIN_SERVER) \
$(LIBBITCOIN_COMMON) \
$(LIBBITCOIN_UTIL) \
$(LIBBITCOIN_CNUTILS) \
$(LIBBITCOIN_CONSENSUS) \
$(LIBBITCOIN_CRYPTO) \
$(LIBLEVELDB) \

4
src/Makefile.qt.include

@ -436,7 +436,7 @@ endif @@ -436,7 +436,7 @@ endif
if ENABLE_ZMQ
qt_kevacoin_qt_LDADD += $(LIBBITCOIN_ZMQ) $(ZMQ_LIBS)
endif
qt_kevacoin_qt_LDADD += $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CONSENSUS) $(LIBBITCOIN_CRYPTO) $(LIBUNIVALUE) $(LIBLEVELDB) $(LIBLEVELDB_SSE42) $(LIBMEMENV) \
qt_kevacoin_qt_LDADD += $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CNUTILS) $(LIBBITCOIN_CONSENSUS) $(LIBBITCOIN_CRYPTO) $(LIBUNIVALUE) $(LIBLEVELDB) $(LIBLEVELDB_SSE42) $(LIBMEMENV) \
$(BOOST_LIBS) $(QT_LIBS) $(QT_DBUS_LIBS) $(QR_LIBS) $(PROTOBUF_LIBS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) $(LIBSECP256K1) \
$(EVENT_PTHREADS_LIBS) $(EVENT_LIBS)
qt_kevacoin_qt_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(QT_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
@ -447,7 +447,7 @@ QT_QM=$(QT_TS:.ts=.qm) @@ -447,7 +447,7 @@ QT_QM=$(QT_TS:.ts=.qm)
SECONDARY: $(QT_QM)
$(srcdir)/qt/bitcoinstrings.cpp: $(libbitcoin_server_a_SOURCES) $(libbitcoin_wallet_a_SOURCES) $(libbitcoin_common_a_SOURCES) $(libbitcoin_zmq_a_SOURCES) $(libbitcoin_consensus_a_SOURCES) $(libbitcoin_util_a_SOURCES)
$(srcdir)/qt/bitcoinstrings.cpp: $(libbitcoin_server_a_SOURCES) $(libbitcoin_wallet_a_SOURCES) $(libbitcoin_common_a_SOURCES) $(libbitcoin_zmq_a_SOURCES) $(libbitcoin_consensus_a_SOURCES) $(libbitcoin_util_a_SOURCES) $(libbitcoin_cnutils_a_SOURCES)
@test -n $(XGETTEXT) || echo "xgettext is required for updating translations"
$(AM_V_GEN) cd $(srcdir); XGETTEXT=$(XGETTEXT) PACKAGE_NAME="$(PACKAGE_NAME)" COPYRIGHT_HOLDERS="$(COPYRIGHT_HOLDERS)" COPYRIGHT_HOLDERS_SUBSTITUTION="$(COPYRIGHT_HOLDERS_SUBSTITUTION)" $(PYTHON) ../share/qt/extract_strings_qt.py $^

2
src/Makefile.qttest.include

@ -57,7 +57,7 @@ endif @@ -57,7 +57,7 @@ endif
if ENABLE_ZMQ
qt_test_test_kevacoin_qt_LDADD += $(LIBBITCOIN_ZMQ) $(ZMQ_LIBS)
endif
qt_test_test_kevacoin_qt_LDADD += $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CONSENSUS) $(LIBBITCOIN_CRYPTO) $(LIBUNIVALUE) $(LIBLEVELDB) \
qt_test_test_kevacoin_qt_LDADD += $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CNUTILS) $(LIBBITCOIN_CONSENSUS) $(LIBBITCOIN_CRYPTO) $(LIBUNIVALUE) $(LIBLEVELDB) \
$(LIBLEVELDB_SSE42) $(LIBMEMENV) $(BOOST_LIBS) $(QT_DBUS_LIBS) $(QT_TEST_LIBS) $(QT_LIBS) \
$(QR_LIBS) $(PROTOBUF_LIBS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) $(LIBSECP256K1) \
$(EVENT_PTHREADS_LIBS) $(EVENT_LIBS)

3
src/Makefile.test.include

@ -104,7 +104,7 @@ test_test_kevacoin_LDADD = @@ -104,7 +104,7 @@ test_test_kevacoin_LDADD =
if ENABLE_WALLET
test_test_kevacoin_LDADD += $(LIBBITCOIN_WALLET)
endif
test_test_kevacoin_LDADD += $(LIBBITCOIN_SERVER) $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CONSENSUS) $(LIBBITCOIN_CRYPTO) $(LIBUNIVALUE) \
test_test_kevacoin_LDADD += $(LIBBITCOIN_SERVER) $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CNUTILS) $(LIBBITCOIN_CONSENSUS) $(LIBBITCOIN_CRYPTO) $(LIBUNIVALUE) \
$(LIBLEVELDB) $(LIBLEVELDB_SSE42) $(LIBMEMENV) $(BOOST_LIBS) $(BOOST_UNIT_TEST_FRAMEWORK_LIB) $(LIBSECP256K1) $(EVENT_LIBS) $(EVENT_PTHREADS_LIBS)
test_test_kevacoin_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
@ -127,6 +127,7 @@ test_test_kevacoin_fuzzy_LDADD = \ @@ -127,6 +127,7 @@ test_test_kevacoin_fuzzy_LDADD = \
$(LIBBITCOIN_SERVER) \
$(LIBBITCOIN_COMMON) \
$(LIBBITCOIN_UTIL) \
$(LIBBITCOIN_CNUTILS) \
$(LIBBITCOIN_CONSENSUS) \
$(LIBBITCOIN_CRYPTO) \
$(LIBSECP256K1)

2
src/cn_utils/contrib/epee/include/storages/portable_storage_val_converters.h

@ -30,7 +30,7 @@ @@ -30,7 +30,7 @@
#include "misc_language.h"
#include "portable_storage_base.h"
#include "warnings.h"
#include "epee/include/warnings.h"
namespace epee
{

2
src/cn_utils/crypto/chacha8.c

@ -10,7 +10,7 @@ Public domain. @@ -10,7 +10,7 @@ Public domain.
#include "chacha8.h"
#include "common/int-util.h"
#include "warnings.h"
#include "epee/include/warnings.h"
/*
* The following macros are used to obtain exact-width results.

2
src/cn_utils/crypto/crypto-ops.c

@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
#include <assert.h>
#include <stdint.h>
#include "warnings.h"
#include "epee/include/warnings.h"
#include "crypto-ops.h"
DISABLE_VS_WARNINGS(4146 4244)

2
src/cn_utils/crypto/crypto.cpp

@ -12,7 +12,7 @@ @@ -12,7 +12,7 @@
#include <mutex>
#include "common/varint.h"
#include "warnings.h"
#include "epee/include/warnings.h"
#include "crypto.h"
#include "hash.h"

2
src/cn_utils/crypto/hash-ops.h

@ -12,7 +12,7 @@ @@ -12,7 +12,7 @@
#include <stdint.h>
#include "common/int-util.h"
#include "warnings.h"
#include "epee/include/warnings.h"
static inline void *padd(void *p, size_t i) {
return (char *) p + i;

2
src/cn_utils/cryptonote_core/account.cpp

@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
#include "include_base_utils.h"
#include "account.h"
#include "warnings.h"
#include "epee/include/warnings.h"
#include "crypto/crypto.h"
#include "cryptonote_core/cryptonote_basic_impl.h"
#include "cryptonote_core/cryptonote_format_utils.h"

2
src/cn_utils/cryptonote_core/blockchain_storage.cpp

@ -19,7 +19,7 @@ @@ -19,7 +19,7 @@
#include "profile_tools.h"
#include "file_io_utils.h"
#include "common/boost_serialization_helper.h"
#include "warnings.h"
#include "epee/include/warnings.h"
#include "crypto/hash.h"
//#include "serialization/json_archive.h"

10
src/cn_utils/cryptonote_core/cryptonote_core.cpp

@ -11,7 +11,7 @@ using namespace epee; @@ -11,7 +11,7 @@ using namespace epee;
#include "cryptonote_core.h"
#include "common/command_line.h"
#include "common/util.h"
#include "warnings.h"
#include "epee/include/warnings.h"
#include "crypto/crypto.h"
#include "cryptonote_config.h"
#include "cryptonote_format_utils.h"
@ -27,7 +27,7 @@ namespace cryptonote @@ -27,7 +27,7 @@ namespace cryptonote
m_mempool(m_blockchain_storage),
m_blockchain_storage(m_mempool),
m_miner(this),
m_miner_address(boost::value_initialized<account_public_address>()),
m_miner_address(boost::value_initialized<account_public_address>()),
m_starter_message_showed(false)
{
set_cryptonote_protocol(pprotocol);
@ -499,14 +499,14 @@ namespace cryptonote @@ -499,14 +499,14 @@ namespace cryptonote
{
if(!m_starter_message_showed)
{
LOG_PRINT_L0(ENDL << "**********************************************************************" << ENDL
<< "The daemon will start synchronizing with the network. It may take up to several hours." << ENDL
LOG_PRINT_L0(ENDL << "**********************************************************************" << ENDL
<< "The daemon will start synchronizing with the network. It may take up to several hours." << ENDL
<< ENDL
<< "You can set the level of process detailization by using command \"set_log <level>\", where <level> is either 0 (no details), 1 (current block height synchronized), or 2 (all details)." << ENDL
<< ENDL
<< "Use \"help\" command to see the list of available commands." << ENDL
<< ENDL
<< "Note: in case you need to interrupt the process, use \"exit\" command. Otherwise, the current progress won't be saved." << ENDL
<< "Note: in case you need to interrupt the process, use \"exit\" command. Otherwise, the current progress won't be saved." << ENDL
<< "**********************************************************************");
m_starter_message_showed = true;
}

2
src/cn_utils/cryptonote_core/cryptonote_core.h

@ -15,7 +15,7 @@ @@ -15,7 +15,7 @@
#include "miner.h"
#include "connection_context.h"
#include "cryptonote_core/cryptonote_stat_info.h"
#include "warnings.h"
#include "epee/include/warnings.h"
#include "crypto/hash.h"
PUSH_WARNINGS

2
src/cn_utils/cryptonote_core/tx_pool.cpp

@ -15,7 +15,7 @@ @@ -15,7 +15,7 @@
#include "common/boost_serialization_helper.h"
#include "common/int-util.h"
#include "misc_language.h"
#include "warnings.h"
#include "epee/include/warnings.h"
#include "crypto/hash.h"
DISABLE_VS_WARNINGS(4244 4345 4503) //'boost::foreach_detail_::or_' : decorated name length exceeded, name was truncated

4
src/cn_utils/cryptonote_protocol/cryptonote_protocol_handler.h

@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
#include <boost/program_options/variables_map.hpp>
#include "storages/levin_abstract_invoke2.h"
#include "warnings.h"
#include "epee/include/warnings.h"
#include "cryptonote_protocol_defs.h"
#include "cryptonote_protocol_handler_common.h"
#include "cryptonote_core/connection_context.h"
@ -22,7 +22,7 @@ namespace cryptonote @@ -22,7 +22,7 @@ namespace cryptonote
template<class t_core>
class t_cryptonote_protocol_handler: public i_cryptonote_protocol
{
{
public:
typedef cryptonote_connection_context connection_context;
typedef core_stat_info stat_info;

4
src/cn_utils/p2p/net_node.h

@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
#include <boost/program_options/variables_map.hpp>
#include <boost/serialization/version.hpp>
#include "warnings.h"
#include "epee/include/warnings.h"
#include "net/levin_server_cp2.h"
#include "p2p_protocol_defs.h"
#include "storages/levin_abstract_invoke2.h"
@ -142,7 +142,7 @@ namespace nodetool @@ -142,7 +142,7 @@ namespace nodetool
bool try_to_connect_and_handshake_with_new_peer(const net_address& na, bool just_take_peerlist = false, uint64_t last_seen_stamp = 0, bool white = true);
size_t get_random_index_with_fixed_probability(size_t max_index);
bool is_peer_used(const peerlist_entry& peer);
bool is_addr_connected(const net_address& peer);
bool is_addr_connected(const net_address& peer);
template<class t_callback>
bool try_ping(basic_node_data& node_data, p2p_connection_context& context, t_callback cb);
bool make_expected_connections_count(bool white_list, size_t expected_connections);

2
src/cn_utils/serialization/binary_archive.h

@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@
#include <boost/type_traits/make_unsigned.hpp>
#include "common/varint.h"
#include "warnings.h"
#include "epee/include/warnings.h"
PUSH_WARNINGS
DISABLE_VS_WARNINGS(4244)

Loading…
Cancel
Save