Skip to content

Commit

Permalink
Merge pull request #317 from mvs-org/0.8.2/sdk
Browse files Browse the repository at this point in the history
Release v0.8.2
  • Loading branch information
codrush authored Jul 17, 2018
2 parents a4072d7 + 9aa8a0f commit e440195
Show file tree
Hide file tree
Showing 187 changed files with 10,567 additions and 914 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ ENDIF()
IF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 ${COMMON_ARGS}")
#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")
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")

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

SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fPIC")
Expand Down
4 changes: 0 additions & 4 deletions builds/msvc-140/bitcoin/bitcoin.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@
<ClCompile Include="..\..\..\src\lib\bitcoin\math\stealth.cpp" />
<ClCompile Include="..\..\..\src\lib\bitcoin\math\uint256.cpp" />
<ClCompile Include="..\..\..\src\lib\bitcoin\message\address.cpp" />
<ClCompile Include="..\..\..\src\lib\bitcoin\message\alert.cpp" />
<ClCompile Include="..\..\..\src\lib\bitcoin\message\alert_payload.cpp" />
<ClCompile Include="..\..\..\src\lib\bitcoin\message\block_message.cpp" />
<ClCompile Include="..\..\..\src\lib\bitcoin\message\block_transactions.cpp" />
<ClCompile Include="..\..\..\src\lib\bitcoin\message\compact_block.cpp" />
Expand Down Expand Up @@ -233,8 +231,6 @@
<ClInclude Include="..\..\..\include\metaverse\bitcoin\math\uint256.hpp" />
<ClInclude Include="..\..\..\include\metaverse\bitcoin\messages.hpp" />
<ClInclude Include="..\..\..\include\metaverse\bitcoin\message\address.hpp" />
<ClInclude Include="..\..\..\include\metaverse\bitcoin\message\alert.hpp" />
<ClInclude Include="..\..\..\include\metaverse\bitcoin\message\alert_payload.hpp" />
<ClInclude Include="..\..\..\include\metaverse\bitcoin\message\block_message.hpp" />
<ClInclude Include="..\..\..\include\metaverse\bitcoin\message\block_transactions.hpp" />
<ClInclude Include="..\..\..\include\metaverse\bitcoin\message\compact_block.hpp" />
Expand Down
12 changes: 0 additions & 12 deletions builds/msvc-140/bitcoin/bitcoin.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -395,12 +395,6 @@
<ClCompile Include="..\..\..\src\lib\bitcoin\message\address.cpp">
<Filter>Source Files\message</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\lib\bitcoin\message\alert.cpp">
<Filter>Source Files\message</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\lib\bitcoin\message\alert_payload.cpp">
<Filter>Source Files\message</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\lib\bitcoin\message\block_message.cpp">
<Filter>Source Files\message</Filter>
</ClCompile>
Expand Down Expand Up @@ -823,9 +817,6 @@
<ClInclude Include="..\..\..\include\metaverse\bitcoin\math\checksum.hpp">
<Filter>Header Files\math</Filter>
</ClInclude>
<ClInclude Include="..\..\..\include\metaverse\bitcoin\message\alert_payload.hpp">
<Filter>Header Files\message</Filter>
</ClInclude>
<ClInclude Include="..\..\..\include\metaverse\bitcoin\message\block_message.hpp">
<Filter>Header Files\message</Filter>
</ClInclude>
Expand Down Expand Up @@ -919,9 +910,6 @@
<ClInclude Include="..\..\..\include\metaverse\bitcoin\message\address.hpp">
<Filter>Header Files\message</Filter>
</ClInclude>
<ClInclude Include="..\..\..\include\metaverse\bitcoin\message\alert.hpp">
<Filter>Header Files\message</Filter>
</ClInclude>
<ClInclude Include="..\..\..\include\metaverse\bitcoin\unicode\console_streambuf.hpp">
<Filter>Header Files\unicode</Filter>
</ClInclude>
Expand Down
4 changes: 0 additions & 4 deletions builds/msvc/vs2015/metaverse.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -509,8 +509,6 @@
<ClCompile Include="..\..\..\src\lib\bitcoin\message\send_compact_blocks.cpp" />
<ClCompile Include="..\..\..\src\lib\bitcoin\message\block_transactions.cpp" />
<ClCompile Include="..\..\..\src\lib\bitcoin\message\ping.cpp" />
<ClCompile Include="..\..\..\src\lib\bitcoin\message\alert_payload.cpp" />
<ClCompile Include="..\..\..\src\lib\bitcoin\message\alert.cpp" />
<ClCompile Include="..\..\..\src\lib\bitcoin\message\memory_pool.cpp" />
<ClCompile Include="..\..\..\src\lib\bitcoin\message\get_address.cpp" />
<ClCompile Include="..\..\..\src\lib\bitcoin\message\block_message.cpp" />
Expand Down Expand Up @@ -1080,13 +1078,11 @@
<ClInclude Include="..\..\..\include\metaverse\bitcoin\message\send_compact_blocks.hpp" />
<ClInclude Include="..\..\..\include\metaverse\bitcoin\message\fee_filter.hpp" />
<ClInclude Include="..\..\..\include\metaverse\bitcoin\message\transaction_message.hpp" />
<ClInclude Include="..\..\..\include\metaverse\bitcoin\message\alert.hpp" />
<ClInclude Include="..\..\..\include\metaverse\bitcoin\message\block_message.hpp" />
<ClInclude Include="..\..\..\include\metaverse\bitcoin\message\pong.hpp" />
<ClInclude Include="..\..\..\include\metaverse\bitcoin\message\compact_block.hpp" />
<ClInclude Include="..\..\..\include\metaverse\bitcoin\message\version.hpp" />
<ClInclude Include="..\..\..\include\metaverse\bitcoin\message\inventory.hpp" />
<ClInclude Include="..\..\..\include\metaverse\bitcoin\message\alert_payload.hpp" />
<ClInclude Include="..\..\..\include\metaverse\bitcoin\message\header_message.hpp" />
<ClInclude Include="..\..\..\include\metaverse\bitcoin\message\headers.hpp" />
<ClInclude Include="..\..\..\include\metaverse\bitcoin\message\filter_add.hpp" />
Expand Down
12 changes: 0 additions & 12 deletions builds/msvc/vs2015/metaverse.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -1176,12 +1176,6 @@
<ClCompile Include="..\..\..\src\lib\bitcoin\message\ping.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\lib\bitcoin\message\alert_payload.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\lib\bitcoin\message\alert.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\lib\bitcoin\message\memory_pool.cpp">
<Filter>Source Files</Filter>
</ClCompile>
Expand Down Expand Up @@ -2900,9 +2894,6 @@
<ClInclude Include="..\..\..\include\metaverse\bitcoin\message\transaction_message.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\include\metaverse\bitcoin\message\alert.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\include\metaverse\bitcoin\message\block_message.hpp">
<Filter>Header Files</Filter>
</ClInclude>
Expand All @@ -2918,9 +2909,6 @@
<ClInclude Include="..\..\..\include\metaverse\bitcoin\message\inventory.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\include\metaverse\bitcoin\message\alert_payload.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\include\metaverse\bitcoin\message\header_message.hpp">
<Filter>Header Files</Filter>
</ClInclude>
Expand Down
28 changes: 16 additions & 12 deletions contrib/jsoncpp/jsoncpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,28 @@
// //////////////////////////////////////////////////////////////////////

/*
The JsonCpp library's source code, including accompanying documentation,
The JsonCpp library's source code, including accompanying documentation,
tests and demonstration applications, are licensed under the following
conditions...
Baptiste Lepilleur and The JsonCpp Authors explicitly disclaim copyright in all
jurisdictions which recognize such a disclaimer. In such jurisdictions,
Baptiste Lepilleur and The JsonCpp Authors explicitly disclaim copyright in all
jurisdictions which recognize such a disclaimer. In such jurisdictions,
this software is released into the Public Domain.
In jurisdictions which do not recognize Public Domain property (e.g. Germany as of
2010), this software is Copyright (c) 2007-2010 by Baptiste Lepilleur and
The JsonCpp Authors, and is released under the terms of the MIT License (see below).
In jurisdictions which recognize Public Domain property, the user of this
software may choose to accept it either as 1) Public Domain, 2) under the
conditions of the MIT License (see below), or 3) under the terms of dual
In jurisdictions which recognize Public Domain property, the user of this
software may choose to accept it either as 1) Public Domain, 2) under the
conditions of the MIT License (see below), or 3) under the terms of dual
Public Domain/MIT License conditions described here, as they choose.
The MIT License is about as close to Public Domain as a license can get, and is
described in clear, concise terms at:
http://en.wikipedia.org/wiki/MIT_License
The full text of the MIT License follows:
========================================================================
Expand Down Expand Up @@ -238,7 +238,7 @@ static inline void fixNumericLocaleInput(char* begin, char* end) {
#include <limits>

#if defined(_MSC_VER)
#if !defined(WINCE) && defined(__STDC_SECURE_LIB__) && _MSC_VER >= 1500 // VC++ 9.0 and above
#if !defined(WINCE) && defined(__STDC_SECURE_LIB__) && _MSC_VER >= 1500 // VC++ 9.0 and above
#define snprintf sprintf_s
#elif _MSC_VER >= 1900 // VC++ 14.0 and above
#define snprintf std::snprintf
Expand Down Expand Up @@ -382,7 +382,7 @@ bool Reader::parse(const char* beginDoc,

bool Reader::readValue() {
// readValue() may call itself only if it calls readObject() or ReadArray().
// These methods execute nodes_.push() just before and nodes_.pop)() just after calling readValue().
// These methods execute nodes_.push() just before and nodes_.pop)() just after calling readValue().
// parse() executes one nodes_.push(), so > instead of >=.
if (nodes_.size() > stackLimit_g) throwRuntimeError("Exceeded stackLimit in readValue().");

Expand Down Expand Up @@ -3549,9 +3549,13 @@ Value& Value::resolveReference(const char* key) {
// @param key is not null-terminated.
Value& Value::resolveReference(char const* key, char const* cend)
{
std::string info("in Json::Value::resolveReference(key, end): requires objectValue. ");
info += "key: "; info += key;
info += ", cend: "; info += cend;

JSON_ASSERT_MESSAGE(
type_ == nullValue || type_ == objectValue,
"in Json::Value::resolveReference(key, end): requires objectValue");
info);
if (type_ == nullValue)
*this = Value(objectValue);
CZString actualKey(
Expand Down Expand Up @@ -4214,7 +4218,7 @@ Value& Path::make(Value& root) const {
#endif
#endif

#if defined(__BORLANDC__)
#if defined(__BORLANDC__)
#include <float.h>
#define isfinite _finite
#define snprintf _snprintf
Expand Down Expand Up @@ -5288,7 +5292,7 @@ StreamWriter* StreamWriterBuilder::newStreamWriter() const
JSONCPP_STRING cs_str = settings_["commentStyle"].asString();
bool eyc = settings_["enableYAMLCompatibility"].asBool();
bool dnp = settings_["dropNullPlaceholders"].asBool();
bool usf = settings_["useSpecialFloats"].asBool();
bool usf = settings_["useSpecialFloats"].asBool();
unsigned int pre = settings_["precision"].asUInt();
CommentStyle::Enum cs = CommentStyle::All;
if (cs_str == "All") {
Expand Down
2 changes: 0 additions & 2 deletions include/metaverse/bitcoin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@
#include <metaverse/bitcoin/math/stealth.hpp>
#include <metaverse/bitcoin/math/uint256.hpp>
#include <metaverse/bitcoin/message/address.hpp>
#include <metaverse/bitcoin/message/alert.hpp>
#include <metaverse/bitcoin/message/alert_payload.hpp>
#include <metaverse/bitcoin/message/block_message.hpp>
#include <metaverse/bitcoin/message/block_transactions.hpp>
#include <metaverse/bitcoin/message/compact_block.hpp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,6 @@ class BC_API account
uint8_t get_priority() const;
void set_priority(const uint8_t priority);

void set_user_status(const uint8_t status);
uint8_t get_user_status() const;

void set_system_status(const uint8_t status);
uint8_t get_system_status() const;

void set_type(uint8_t type);
uint8_t get_type() const;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class BC_API asset_cert

static std::string get_domain(const std::string& symbol);
static bool is_valid_domain(const std::string& domain);
static std::string get_key(const std::string&symbol, asset_cert_type bit);
static std::string get_key(const std::string&symbol, const asset_cert_type& bit);

private:
// NOTICE: ref CAssetCert in transaction.h
Expand Down
1 change: 0 additions & 1 deletion include/metaverse/bitcoin/chain/output.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ class BC_API output
std::string to_string(uint32_t flags) const;
bool is_valid() const;
code check_attachment_address(bc::blockchain::block_chain_impl& chain) const;
code check_attachment_did_match_address(bc::blockchain::block_chain_impl& chain) const;
std::string get_script_address() const;
void reset();
uint64_t serialized_size() const;
Expand Down
6 changes: 6 additions & 0 deletions include/metaverse/bitcoin/constants.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ BC_CONSTEXPR uint32_t max_input_sequence = max_uint32;

BC_CONSTEXPR uint32_t total_reward = 100000000;

BC_CONSTEXPR uint64_t min_fee_to_issue_asset = 10 * 100000000;
BC_CONSTEXPR uint64_t min_fee_to_register_did = 1 * 100000000;
BC_CONSTEXPR uint32_t min_fee_percentage_to_miner = 20;

// Threshold for nLockTime: below this value it is interpreted as block number,
// otherwise as UNIX timestamp. [Tue Nov 5 00:53:20 1985 UTC]
BC_CONSTEXPR uint32_t locktime_threshold = 500000000;
Expand Down Expand Up @@ -117,6 +121,8 @@ BC_CONSTEXPR message::network_address unspecified_network_address
// TODO: make static.
BC_API hash_number max_target();

BC_API std::string get_developer_community_address(bool is_testnet);

} // namespace libbitcoin

#endif
2 changes: 0 additions & 2 deletions include/metaverse/bitcoin/messages.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@

#include <cstdint>
#include <metaverse/bitcoin/message/address.hpp>
#include <metaverse/bitcoin/message/alert.hpp>
#include <metaverse/bitcoin/message/alert_payload.hpp>
#include <metaverse/bitcoin/message/block_message.hpp>
#include <metaverse/bitcoin/message/block_transactions.hpp>
#include <metaverse/bitcoin/message/compact_block.hpp>
Expand Down
4 changes: 2 additions & 2 deletions include/metaverse/bitcoin/version.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
* For interpretation of the versioning scheme see: http://semver.org
*/

#define MVS_VERSION "0.8.1"
#define MVS_VERSION "0.8.2"
#define MVS_MAJOR_VERSION 0
#define MVS_MINOR_VERSION 8
#define MVS_PATCH_VERSION 1
#define MVS_PATCH_VERSION 2

#endif
26 changes: 13 additions & 13 deletions include/metaverse/blockchain/block_chain_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,6 @@ class BCB_API block_chain_impl
operation_result store_account(std::shared_ptr<account> acc);
std::shared_ptr<account> get_account(const std::string& name);
std::shared_ptr<std::vector<account>> get_accounts();
account_status get_account_user_status(const std::string& name);
account_status get_account_system_status(const std::string& name);
bool set_account_user_status(const std::string& name, uint8_t status);
bool set_account_system_status(const std::string& name, uint8_t status);
operation_result delete_account(const std::string& name);
operation_result delete_account_address(const std::string& name);

Expand All @@ -257,8 +253,9 @@ class BCB_API block_chain_impl
uint64_t get_account_asset_volume(const std::string& account, const std::string& asset);
uint64_t get_asset_volume(const std::string& asset);

// asset api
bool is_asset_exist(const std::string& asset_name, bool check_local_db=true);
bool get_asset_height(const std::string& asset_name, uint64_t& height);
uint64_t get_asset_height(const std::string& asset_name) const ;
std::shared_ptr<asset_detail::list> get_local_assets();
std::shared_ptr<asset_detail::list> get_issued_assets();
std::shared_ptr<asset_detail> get_issued_asset(const std::string& symbol);
Expand All @@ -269,6 +266,7 @@ class BCB_API block_chain_impl

// cert api
bool is_asset_cert_exist(const std::string& symbol, asset_cert_type cert_type);
uint64_t get_asset_cert_height(const std::string& cert_symbol,const asset_cert_type& cert_type);
std::shared_ptr<asset_cert::list> get_issued_asset_certs();
std::shared_ptr<asset_cert> get_account_asset_cert(
const std::string& account, const std::string& symbol, asset_cert_type cert_type);
Expand All @@ -278,6 +276,8 @@ class BCB_API block_chain_impl
const std::string& address, const std::string& symbol, asset_cert_type cert_type);

// identifiable asset
bool is_asset_mit_exist(const std::string& symbol);
uint64_t get_asset_mit_height(const std::string& mit_symbol)const;
std::shared_ptr<asset_mit_info> get_registered_mit(const std::string& symbol);
std::shared_ptr<asset_mit_info::list> get_registered_mits();
std::shared_ptr<asset_mit_info::list> get_mit_history(const std::string& symbol,
Expand All @@ -287,10 +287,10 @@ class BCB_API block_chain_impl

// account did api
bool is_did_exist(const std::string& symbol);
bool get_did_height(const std::string& symbol, uint64_t& height);
bool is_address_registered_did(const std::string& address);
uint64_t get_did_height(const std::string& symbol) const;
bool is_address_registered_did(const std::string& address, uint64_t fork_index = max_uint64);
bool is_account_owned_did(const std::string& account, const std::string& symbol);
std::string get_did_from_address(const std::string& address);
std::string get_did_from_address(const std::string& address, uint64_t fork_index = max_uint64);
std::shared_ptr<did_detail> get_registered_did(const std::string& symbol);
std::shared_ptr<did_detail::list> get_registered_dids();
std::shared_ptr<did_detail::list> get_account_dids(const std::string& account);
Expand Down Expand Up @@ -320,11 +320,11 @@ class BCB_API block_chain_impl
std::shared_ptr<account_address::list> get_account_addresses(const std::string& name);
void uppercase_symbol(std::string& symbol);

bool is_valid_address(const std::string& address);
bool is_payment_address(const std::string& address);
bool is_stealth_address(const std::string& address);
bool is_script_address(const std::string& address);
bool is_blackhole_address(const std::string& address);
static bool is_valid_address(const std::string& address);
static bool is_payment_address(const std::string& address);
static bool is_stealth_address(const std::string& address);
static bool is_script_address(const std::string& address);
static bool is_blackhole_address(const std::string& address);

void fired();
organizer& get_organizer();
Expand Down
11 changes: 10 additions & 1 deletion include/metaverse/blockchain/validate_block.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class BCB_API validate_block
public:
code check_block(blockchain::block_chain_impl& chain) const;
code accept_block() const;
code connect_block(hash_digest& err_tx) const;
code connect_block(hash_digest& err_tx, blockchain::block_chain_impl& chain) const;

/// Required to call before calling accept_block or connect_block.
void initialize_context();
Expand All @@ -55,6 +55,15 @@ class BCB_API validate_block

bool get_transaction(const hash_digest& tx_hash, chain::transaction& prev_tx, size_t& prev_height) const;

virtual std::string get_did_from_address_consider_orphan_chain(const std::string& address, const std::string& did_symbol) const = 0;
virtual bool is_did_match_address_in_orphan_chain(const std::string& symbol, const std::string& address) const = 0;
virtual bool is_did_in_orphan_chain(const std::string& symbol) const = 0;
virtual bool is_asset_in_orphan_chain(const std::string& symbol) const = 0;
virtual bool is_asset_cert_in_orphan_chain(const std::string& symbol, asset_cert_type cert_type) const = 0;
virtual bool is_asset_mit_in_orphan_chain(const std::string& symbol) const = 0;

virtual size_t get_fork_index() const { return max_size_t; }

protected:
typedef std::vector<uint8_t> versions;
typedef std::function<bool()> stopped_callback;
Expand Down
Loading

0 comments on commit e440195

Please sign in to comment.