Skip to content

Commit

Permalink
Merge pull request #347 from mvs-org/0.9.0
Browse files Browse the repository at this point in the history
0.9.0 - fix testnet sync problem at height 987948
  • Loading branch information
codrush authored Feb 3, 2019
2 parents af73817 + fa2648b commit 1e8b3be
Show file tree
Hide file tree
Showing 64 changed files with 329 additions and 412 deletions.
15 changes: 8 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ IF(${CMAKE_CXX_COMPILER} MATCHES .*android.*)
SET(ANDROID 1)
ENDIF()

SET(COMMON_WARN "-Wall -Wextra -Wstrict-aliasing=2 -Wno-unused-parameter -Wno-unused-variable -Wno-type-limits")
SET(COMMON_WARN "-Wall -Wextra -Wno-unused-parameter -Wno-unused-variable -Wno-type-limits -Wno-deprecated-declarations")
if (NOT ANDROID)
SET(COMMON_WARN "${COMMON_WARN} -Werror")
endif()
SET(COMMON_FLAGS "-fstrict-aliasing -fvisibility=hidden")
SET(COMMON_FLAGS "-fvisibility=hidden")
SET(COMMON_ARGS "${COMMON_FLAGS} ${COMMON_WARN}")

IF (APPLE)
Expand All @@ -43,12 +43,12 @@ ENDIF()

# GXX/Clang settings
IF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 ${COMMON_ARGS}")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11")
#libbitcoin has too many ignored-qualifiers, and TODOs
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 ${COMMON_ARGS} -pthread -fno-enforce-eh-specs -fnothrow-opt -Wno-reorder -Wno-ignored-qualifiers -Wno-unused-function -Wno-unused-but-set-variable -Wno-sign-compare -Wno-unused-but-set-parameter -Wno-implicit-fallthrough")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 ${COMMON_ARGS} -pthread -fno-enforce-eh-specs -fnothrow-opt -Wno-reorder -Wno-ignored-qualifiers -Wno-unused-function -Wno-unused-but-set-variable -Wno-sign-compare -Wno-unused-but-set-parameter -Wno-implicit-fallthrough -Wno-parentheses")

ELSEIF("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
SET(CMAKE_C_FLAGS "-std=c11 ${COMMON_ARGS}")
SET(CMAKE_C_FLAGS "-std=c11")
SET(CMAKE_CXX_FLAGS "-std=c++14 ${COMMON_ARGS} -Wno-reorder -Wno-ignored-qualifiers -Wno-missing-braces -Wno-mismatched-tags -Wno-sometimes-uninitialized -Wno-macro-redefined -Wno-uninitialized -Wno-unused-private-field -Wno-unused-function -Wno-implicit-fallthrough")
ENDIF()

Expand Down Expand Up @@ -123,10 +123,11 @@ ENDIF()

# ------------------ MVS Includes --------------------
INCLUDE_DIRECTORIES("${Boost_INCLUDE_DIRS}")
INCLUDE_DIRECTORIES("${PROJECT_SOURCE_DIR}/contrib")
INCLUDE_DIRECTORIES("${PROJECT_SOURCE_DIR}/include")
INCLUDE_DIRECTORIES("${secp256k1_INCLUDE_DIRS}")
INCLUDE_DIRECTORIES("${ZeroMQ_INCLUDE_DIRS}")
INCLUDE_DIRECTORIES("${PROJECT_SOURCE_DIR}/contrib")
INCLUDE_DIRECTORIES("${PROJECT_SOURCE_DIR}/include")
INCLUDE_DIRECTORIES("${PROJECT_SOURCE_DIR}/src/lib/consensus/clone")

# ------------------ MVS Libraries --------------------
IF(ENABLE_SHARED_LIBS)
Expand Down
4 changes: 1 addition & 3 deletions builds/msvc-140/explorer/explorer.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
<ClInclude Include="..\..\..\include\metaverse\explorer\extensions\commands\deleteaccount.hpp" />
<ClInclude Include="..\..\..\include\metaverse\explorer\extensions\commands\deletelocalasset.hpp" />
<ClInclude Include="..\..\..\include\metaverse\explorer\extensions\commands\deletemultisig.hpp" />
<ClInclude Include="..\..\..\include\metaverse\explorer\extensions\commands\deposit.hpp" />
<ClInclude Include="..\..\..\include\metaverse\explorer\extensions\commands\didchangeaddress.hpp" />
<ClInclude Include="..\..\..\include\metaverse\explorer\extensions\commands\getlocked.hpp" />
<ClInclude Include="..\..\..\include\metaverse\explorer\extensions\commands\getrandom.hpp" />
Expand Down Expand Up @@ -193,7 +192,6 @@
<ClCompile Include="..\..\..\src\lib\explorer\extensions\commands\deleteaccount.cpp" />
<ClCompile Include="..\..\..\src\lib\explorer\extensions\commands\deletelocalasset.cpp" />
<ClCompile Include="..\..\..\src\lib\explorer\extensions\commands\deletemultisig.cpp" />
<ClCompile Include="..\..\..\src\lib\explorer\extensions\commands\deposit.cpp" />
<ClCompile Include="..\..\..\src\lib\explorer\extensions\commands\didchangeaddress.cpp" />
<ClCompile Include="..\..\..\src\lib\explorer\extensions\commands\getlocked.cpp" />
<ClCompile Include="..\..\..\src\lib\explorer\extensions\commands\getrandom.cpp" />
Expand Down Expand Up @@ -346,4 +344,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>
8 changes: 1 addition & 7 deletions builds/msvc-140/explorer/explorer.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,6 @@
<ClInclude Include="..\..\..\include\metaverse\explorer\extensions\commands\deletemultisig.hpp">
<Filter>Header Files\extensions\commands</Filter>
</ClInclude>
<ClInclude Include="..\..\..\include\metaverse\explorer\extensions\commands\deposit.hpp">
<Filter>Header Files\extensions\commands</Filter>
</ClInclude>
<ClInclude Include="..\..\..\include\metaverse\explorer\extensions\commands\sendmore.hpp">
<Filter>Header Files\extensions\commands</Filter>
</ClInclude>
Expand Down Expand Up @@ -543,9 +540,6 @@
<ClCompile Include="..\..\..\src\lib\explorer\extensions\commands\deletemultisig.cpp">
<Filter>Source Files\extensions\commands</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\lib\explorer\extensions\commands\deposit.cpp">
<Filter>Source Files\extensions\commands</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\lib\explorer\extensions\commands\dumpkeyfile.cpp">
<Filter>Source Files\extensions\commands</Filter>
</ClCompile>
Expand Down Expand Up @@ -816,4 +810,4 @@
<Filter>Header Files\extensions\commands</Filter>
</Text>
</ItemGroup>
</Project>
</Project>
2 changes: 0 additions & 2 deletions contrib/cryptojs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
FILE(GLOB_RECURSE cryptojs_SOURCES "*.cpp")

INCLUDE_DIRECTORIES("${PROJECT_SOURCE_DIR}/include")

ADD_LIBRARY(cryptojs_static STATIC ${cryptojs_SOURCES})
SET_TARGET_PROPERTIES(cryptojs_static PROPERTIES OUTPUT_NAME cryptojs)
TARGET_LINK_LIBRARIES(cryptojs_static)
Expand Down
2 changes: 0 additions & 2 deletions contrib/jsoncpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
FILE(GLOB_RECURSE jsoncpp_SOURCES "*.cpp")

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations")

ADD_LIBRARY(jsoncpp_static STATIC ${jsoncpp_SOURCES})
SET_TARGET_PROPERTIES(jsoncpp_static PROPERTIES OUTPUT_NAME jsoncpp)
TARGET_LINK_LIBRARIES(jsoncpp_static)
Expand Down
4 changes: 0 additions & 4 deletions contrib/mongoose/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
FILE(GLOB_RECURSE mongoose_SOURCES "*.c")
#aux_source_directory(${CMAKE_CURRENT_LIST_DIR})
#SET(mongoose_SOURCES ${CMAKE_CURRENT_LIST_DIR})

# Mongoose does not compile with strict aliasing.
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-strict-aliasing")
IF(MG_ENABLE_DEBUG)
ADD_DEFINITIONS(-DMG_ENABLE_DEBUG)
ELSE()
Expand Down
4 changes: 2 additions & 2 deletions contrib/mongoose/mongoose.c
Original file line number Diff line number Diff line change
Expand Up @@ -8161,7 +8161,7 @@ static void mg_send_file_data(struct mg_connection *nc, FILE *fp) {
static void mg_do_ssi_include(struct mg_connection *nc, struct http_message *hm,
const char *ssi, char *tag, int include_level,
const struct mg_serve_http_opts *opts) {
char file_name[BUFSIZ], path[MAX_PATH_SIZE], *p;
char file_name[MAX_PATH_SIZE], path[MAX_PATH_SIZE * 2], *p;
FILE *fp;

/*
Expand Down Expand Up @@ -10363,7 +10363,7 @@ int mg_dns_reply_record(struct mg_dns_reply *reply,

static const char *mg_default_dns_server = "udp://" MG_DEFAULT_NAMESERVER ":53";

MG_INTERNAL char mg_dns_server[256];
MG_INTERNAL char mg_dns_server[256+16];

struct mg_resolve_async_request {
char name[1024];
Expand Down
2 changes: 0 additions & 2 deletions contrib/sodium/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
FILE(GLOB_RECURSE sodium_SOURCES "*.cpp")

INCLUDE_DIRECTORIES("${PROJECT_SOURCE_DIR}/include")

ADD_LIBRARY(sodium_static STATIC ${sodium_SOURCES})
SET_TARGET_PROPERTIES(sodium_static PROPERTIES OUTPUT_NAME sodium)
TARGET_LINK_LIBRARIES(sodium_static)
Expand Down
2 changes: 2 additions & 0 deletions include/metaverse/bitcoin/config/parameter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ class BC_API parameter

public:

virtual ~parameter() {}

/**
* Sentinel - the option is not a positional argument.
*/
Expand Down
2 changes: 2 additions & 0 deletions include/metaverse/bitcoin/message/get_blocks.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ class BC_API get_blocks
get_blocks(const hash_list& start, const hash_digest& stop);
get_blocks(hash_list&& start, hash_digest&& stop);

virtual ~get_blocks() {}

virtual bool from_data(uint32_t version, const data_chunk& data);
virtual bool from_data(uint32_t version, std::istream& stream);
virtual bool from_data(uint32_t version, reader& source);
Expand Down
2 changes: 2 additions & 0 deletions include/metaverse/bitcoin/message/inventory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ class BC_API inventory
inventory(const hash_list& hashes, type_id type);
inventory(const std::initializer_list<inventory_vector>& values);

virtual ~inventory() {}

virtual bool from_data(uint32_t version, const data_chunk& data);
virtual bool from_data(uint32_t version, std::istream& stream);
virtual bool from_data(uint32_t version, reader& source);
Expand Down
2 changes: 1 addition & 1 deletion include/metaverse/blockchain/block_chain_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ class BCB_API block_chain_impl
void fired() override;
organizer& get_organizer() override;
bool get_transaction_consider_pool(
chain::transaction& tx, uint64_t& tx_height, const hash_digest& hash);
chain::transaction& tx, uint64_t& tx_height, const hash_digest& hash, bool* is_in_pool=nullptr);
bool get_history(const wallet::payment_address& address,
uint64_t limit, uint64_t from_height, chain::history_compact::list& history);
code validate_transaction(const chain::transaction& tx);
Expand Down
1 change: 1 addition & 0 deletions include/metaverse/blockchain/settings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class BCB_API settings
bool transaction_pool_consistency;
bool use_testnet_rules;
bool collect_split_stake;
bool disable_account_operations;
config::checkpoint::list checkpoints;
config::checkpoint::list basic_checkpoints;
};
Expand Down
2 changes: 2 additions & 0 deletions include/metaverse/database/memory/memory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ class BCD_API memory
public:
typedef std::shared_ptr<memory> ptr;

virtual ~memory() {}

/// Get the address indicated by the pointer.
virtual uint8_t* buffer() = 0;

Expand Down
1 change: 1 addition & 0 deletions include/metaverse/explorer/command.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ enum : int {
class BCX_API command
{
public:
virtual ~command() {}

/**
* The symbolic (not localizable) command name, lower case.
Expand Down
53 changes: 8 additions & 45 deletions include/metaverse/explorer/extensions/base_helper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,8 @@ class BCX_API base_transfer_common

void set_did_verify_attachment(const receiver_record& record, chain::attachment& attach);

virtual bool include_input_script() const { return false; }

protected:
bc::blockchain::block_chain_impl& blockchain_;
tx_type tx_; // target transaction
Expand Down Expand Up @@ -462,12 +464,14 @@ class BCX_API base_transaction_constructor : public base_transfer_common
base_transaction_constructor(bc::blockchain::block_chain_impl& blockchain, utxo_attach_type type,
std::vector<std::string>&& from_vec, receiver_record::list&& receiver_list,
std::string&& symbol, std::string&& change,
std::string&& message, uint64_t fee, uint32_t locktime = 0)
std::string&& message, uint64_t fee, uint32_t locktime = 0,
bool include_input_script = false)
: base_transfer_common(blockchain, std::move(receiver_list), fee,
std::move(symbol), "", std::move(change), locktime)
, type_{type}
, message_{std::move(message)}
, from_vec_{std::move(from_vec)}
, include_input_script_(include_input_script)
{}

virtual ~base_transaction_constructor()
Expand All @@ -483,54 +487,13 @@ class BCX_API base_transaction_constructor : public base_transfer_common
void sign_tx_inputs() override {}
void send_tx() override {}

bool include_input_script() const override { return include_input_script_; }

protected:
utxo_attach_type type_{utxo_attach_type::invalid};
std::string message_;
std::vector<std::string> from_vec_; // from address vector
};

class BCX_API depositing_etp : public base_transfer_helper
{
public:
depositing_etp(command& cmd, bc::blockchain::block_chain_impl& blockchain,
std::string&& name, std::string&& passwd,
std::string&& to, receiver_record::list&& receiver_list,
uint16_t deposit_cycle = 7, uint64_t fee = 10000, uint32_t locktime = 0)
: base_transfer_helper(cmd, blockchain, std::move(name), std::move(passwd),
std::string(""), std::move(receiver_list), fee, "", "", locktime)
, to_{std::move(to)}
, deposit_cycle_{deposit_cycle}
{}

~depositing_etp(){}

chain::operation::stack get_script_operations(const receiver_record& record) const override;

private:
std::string to_;
uint16_t deposit_cycle_{7}; // 7 days
};

class BCX_API depositing_etp_transaction : public base_transaction_constructor
{
public:
depositing_etp_transaction(bc::blockchain::block_chain_impl& blockchain, utxo_attach_type type,
std::vector<std::string>&& from_vec, receiver_record::list&& receiver_list,
uint16_t deposit_cycle, std::string&& change,
std::string&& message, uint64_t fee, uint32_t locktime = 0)
: base_transaction_constructor(
blockchain, type, std::forward<std::vector<std::string>>(from_vec),
std::move(receiver_list), std::string(""),
std::move(change), std::move(message), fee, locktime)
, deposit_cycle_{deposit_cycle}
{}

~depositing_etp_transaction(){}

chain::operation::stack get_script_operations(const receiver_record& record) const override;

private:
uint16_t deposit_cycle_{7}; // 7 days
bool include_input_script_; // set input's script for offline sign
};

class BCX_API sending_etp : public base_transfer_helper
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ class createrawtx: public command_extension
"Locktime. defaults to 0"
)
#endif
(
"putscript,p",
value<bool>(&option_.include_input_script)->default_value(false)->zero_tokens(),
"If specified, then set input's script. Default is not specified."
)
(
"fee,f",
value<uint64_t>(&option_.fee)->default_value(10000),
Expand Down Expand Up @@ -138,6 +143,7 @@ class createrawtx: public command_extension
std::string message;
uint64_t fee;
uint32_t locktime;
bool include_input_script;

} option_;

Expand Down
Loading

0 comments on commit 1e8b3be

Please sign in to comment.