Skip to content

Commit

Permalink
Merge branch 'release'
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptozoidberg committed May 3, 2021
2 parents f0219df + 5c79cf9 commit 82b48a4
Show file tree
Hide file tree
Showing 563 changed files with 11,390 additions and 211,819 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "contrib/db/libmdbx"]
path = contrib/db/libmdbx
url = https://github.com/leo-yuriev/libmdbx.git
[submodule "src/gui/qt-daemon/layout"]
path = src/gui/qt-daemon/layout
url = https://github.com/hyle-team/zano_ui.git
14 changes: 14 additions & 0 deletions contrib/epee/include/serialization/keyvalue_serialization.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,20 @@ public: \



template<typename t_uint>
struct uint_mask_selector
{
template<t_uint mask>
inline static bool get_value_of_flag_by_mask(const t_uint& given_flags)
{
return given_flags&mask == 0 ? false : true;
}
};


#define KV_SERIALIZE_EPHEMERAL_BOOL_FROM_FLAG_N(var, mask, val_name) \
KV_SERIALIZE_EPHEMERAL_N(bool, uint_mask_selector<decltype(var)>::get_value_of_flag_by_mask<mask>, val_name)




Expand Down
11 changes: 9 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ ENDMACRO(ENABLE_SHARED_PCH_EXECUTABLE)

file(GLOB_RECURSE PCH pch/*)
file(GLOB_RECURSE COMMON common/*)
file(GLOB CRYPTO crypto/*.*)
file(GLOB_RECURSE CRYPTO crypto/*)
file(GLOB_RECURSE CURRENCY_CORE currency_core/*)
file(GLOB_RECURSE CURRENCY_PROTOCOL currency_protocol/*)
file(GLOB_RECURSE DAEMON daemon/*)
Expand Down Expand Up @@ -108,6 +108,13 @@ if(NOT MSVC AND NOT APPLE AND NOT CLANG) # TODO(unassigned): do we really need
target_compile_options(common PRIVATE -fno-var-tracking-assignments)
endif()

# disable specific warning in order not to touch original code by D. J. Bernstein
if(MSVC)
set_source_files_properties("crypto/chacha8_stream.c" PROPERTIES COMPILE_FLAGS "/wd4018")
else()
set_source_files_properties("crypto/chacha8_stream.c" PROPERTIES COMPILE_FLAGS "-Wno-sign-compare -Wno-strict-prototypes")
endif()

add_library(crypto ${CRYPTO})

add_library(currency_core ${CURRENCY_CORE})
Expand Down Expand Up @@ -200,7 +207,7 @@ if(BUILD_GUI)
set_property(TARGET Zano PROPERTY FOLDER "prog")
set_target_properties(Zano PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/gui/qt-daemon/Info.plist.in)

set(HTML_DIR ${CMAKE_CURRENT_SOURCE_DIR}/gui/qt-daemon/html)
set(HTML_DIR ${CMAKE_CURRENT_SOURCE_DIR}/gui/qt-daemon/layout/html)
set_target_properties(Zano PROPERTIES VS_DEBUGGER_COMMAND_ARGUMENTS "--html-path=${HTML_DIR}")

set(CMAKE_AUTOMOC OFF)
Expand Down
17 changes: 10 additions & 7 deletions src/common/crypto_stream_operators.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,17 @@
#include "include_base_utils.h"
#include "crypto/crypto.h"
#include "crypto/hash.h"
#include "crypto/RIPEMD160_helper.h"

bool parse_hash256(const std::string str_hash, crypto::hash& hash);

template <class T>
std::ostream &print256(std::ostream &o, const T &v)
std::ostream &print_t(std::ostream &o, const T &v)
{
return o << "<" << epee::string_tools::pod_to_hex(v) << ">";
}


template <class T>
std::ostream &print16(std::ostream &o, const T &v)
{
Expand All @@ -32,10 +34,11 @@ std::string print16(const T &v)

namespace crypto
{
inline std::ostream &operator <<(std::ostream &o, const crypto::public_key &v) { return print256(o, v); }
inline std::ostream &operator <<(std::ostream &o, const crypto::secret_key &v) { return print256(o, v); }
inline std::ostream &operator <<(std::ostream &o, const crypto::key_derivation &v) { return print256(o, v); }
inline std::ostream &operator <<(std::ostream &o, const crypto::key_image &v) { return print256(o, v); }
inline std::ostream &operator <<(std::ostream &o, const crypto::signature &v) { return print256(o, v); }
inline std::ostream &operator <<(std::ostream &o, const crypto::hash &v) { return print256(o, v); }
inline std::ostream &operator <<(std::ostream &o, const crypto::public_key &v) { return print_t(o, v); }
inline std::ostream &operator <<(std::ostream &o, const crypto::secret_key &v) { return print_t(o, v); }
inline std::ostream &operator <<(std::ostream &o, const crypto::key_derivation &v) { return print_t(o, v); }
inline std::ostream &operator <<(std::ostream &o, const crypto::key_image &v) { return print_t(o, v); }
inline std::ostream &operator <<(std::ostream &o, const crypto::signature &v) { return print_t(o, v); }
inline std::ostream &operator <<(std::ostream &o, const crypto::hash &v) { return print_t(o, v); }
inline std::ostream &operator <<(std::ostream &o, const crypto::hash160 &v) { return print_t(o, v); }
} // namespace crypto
1 change: 1 addition & 0 deletions src/common/error_codes.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@
#define API_RETURN_CODE_UNINITIALIZED "UNINITIALIZED"
#define API_RETURN_CODE_TX_IS_TOO_BIG "TX_IS_TOO_BIG"
#define API_RETURN_CODE_TX_REJECTED "TX_REJECTED"
#define API_RETURN_CODE_HTLC_ORIGIN_HASH_MISSMATCHED "HTLC_ORIGIN_HASH_MISSMATCHED"
1 change: 0 additions & 1 deletion src/common/int-util.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
#include <sys/param.h>

#if defined(_MSC_VER)
#include <intrin.h>
Expand Down
11 changes: 6 additions & 5 deletions src/common/pre_download.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ namespace tools
};

#ifndef TESTNET
static constexpr pre_download_entry c_pre_download_mdbx = { "http://95.217.43.225/pre-download/zano_mdbx_95_900000.pak", "1c748d0f90fb1ed0af0ffe59d4b8f6046b2d0f92a8b8fe21932208829733f053", 1097493715, 2147450880 };
static constexpr pre_download_entry c_pre_download_lmdb = { "http://95.217.43.225/pre-download/zano_lmdb_95_900000.pak", "f2d498ed7abf641824eca4ce584c756d6138d670980c1abdddcdf07343f10bfc", 1406827811, 2079617024 };
static constexpr pre_download_entry c_pre_download_mdbx = { "http://95.217.43.225/pre-download/zano_mdbx_95_1000000.pak", "6b0bbba85bc420eaae5ec68373e528f70bffaa17fb111c796e951d06ad71e4fe", 1104150892, 2147450880 };
static constexpr pre_download_entry c_pre_download_lmdb = { "http://95.217.43.225/pre-download/zano_lmdb_95_1000000.pak", "b4d45c727dbf1b92671f9fd1a9624e79019e890bd3d33cb71e011ab4bcb0d21e", 1450748151, 2114449408 };
#else
static constexpr pre_download_entry c_pre_download_mdbx = { "http://95.217.43.225/pre-download/zano_testnet_mdbx_97_700000.pak", "499b4294bbfedccea98bebd369c1fb7c676de0226e9f52657daab45dac908050", 491920310, 1073725440 };
static constexpr pre_download_entry c_pre_download_lmdb = { "http://95.217.43.225/pre-download/zano_testnet_lmdb_97_700000.pak", "a8d5fc57a69576fdd9d538f37af7f1abe3a33c721a597d4a86aa198dcc1d1e0e", 669535639, 1020039168 };
static constexpr pre_download_entry c_pre_download_mdbx = { "", "", 0, 0 };
static constexpr pre_download_entry c_pre_download_lmdb = { "", "", 0, 0 };
#endif

static constexpr uint64_t pre_download_min_size_difference = 512 * 1024 * 1024; // minimum difference in size between local DB and the downloadable one to start downloading
Expand All @@ -50,14 +50,15 @@ namespace tools

boost::system::error_code ec;
uint64_t sz = boost::filesystem::file_size(db_main_file_path, ec);
if (!(ec || (pre_download.unpacked_size > sz && pre_download.unpacked_size - sz > pre_download_min_size_difference) || command_line::has_arg(vm, command_line::arg_force_predownload)) )
if (pre_download.unpacked_size == 0 || !(ec || (pre_download.unpacked_size > sz && pre_download.unpacked_size - sz > pre_download_min_size_difference) || command_line::has_arg(vm, command_line::arg_force_predownload)) )
{
LOG_PRINT_MAGENTA("Pre-downloading not needed (db file size = " << sz << ")", LOG_LEVEL_0);
return true;
}

// okay, let's download


std::string downloading_file_path = db_main_file_path + ".download";

LOG_PRINT_MAGENTA("Trying to download blockchain database from " << url << " ...", LOG_LEVEL_0);
Expand Down
Loading

0 comments on commit 82b48a4

Please sign in to comment.