Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/2.0-dev' into 2.0-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
robert-schmidtke committed Feb 14, 2019
2 parents 1a34510 + bb94ed2 commit bd96480
Show file tree
Hide file tree
Showing 28 changed files with 343 additions and 265 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,16 @@ src/multichain-cli
src/multichain-util
src/multichaind
src/multichaind-cold
src/multichain-cli-wdebug
src/multichain-util-wdebug
src/multichaind-wdebug
src/multichaind-cold-wdebug
src/test/test_bitcoin
src/qt/test/test_bitcoin-qt

local/*
openssl*

# autoreconf
Makefile.in
aclocal.m4
Expand Down
18 changes: 18 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ AC_ARG_ENABLE([wallet],
[enable_wallet=$enableval],
[enable_wallet=yes])

AC_ARG_ENABLE([enterprise],
[AS_HELP_STRING([--enable-enterprise],
[enable enterprise (default is no)])],
[enable_enterprise=$enableval],
[enable_enterprise=no])

AC_ARG_WITH([miniupnpc],
[AS_HELP_STRING([--with-miniupnpc],
[enable UPNP (default is yes if libminiupnpc is found)])],
Expand Down Expand Up @@ -757,6 +763,17 @@ else
AC_MSG_RESULT(no)
fi

dnl enable enterprise
AC_MSG_CHECKING([if enterprise should be enabled])
if test x$enable_enterprise != xno; then
AC_MSG_RESULT(yes)
AC_DEFINE_UNQUOTED([ENABLE_ENTERPRISE],[1],[Define to 1 to enable enterprise functions])

else
AC_MSG_RESULT(no)
fi


dnl enable upnp support
AC_MSG_CHECKING([whether to build with support for UPnP])
if test x$have_miniupnpc = xno; then
Expand Down Expand Up @@ -847,6 +864,7 @@ AM_CONDITIONAL([TARGET_DARWIN], [test x$TARGET_OS = xdarwin])
AM_CONDITIONAL([BUILD_DARWIN], [test x$BUILD_OS = xdarwin])
AM_CONDITIONAL([TARGET_WINDOWS], [test x$TARGET_OS = xwindows])
AM_CONDITIONAL([ENABLE_WALLET],[test x$enable_wallet = xyes])
AM_CONDITIONAL([ENABLE_ENTERPRISE],[test x$enable_enterprise = xyes])
AM_CONDITIONAL([ENABLE_TESTS],[test x$use_tests = xyes])
AM_CONDITIONAL([ENABLE_QT],[test x$bitcoin_enable_qt = xyes])
AM_CONDITIONAL([ENABLE_QT_TESTS],[test x$use_tests$bitcoin_enable_qt_test = xyesyes])
Expand Down
21 changes: 19 additions & 2 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ FwalDIST_SUBDIRS = secp256k1
AM_LDFLAGS = $(PTHREAD_CFLAGS) $(LIBTOOL_LDFLAGS)
CXXFLAGS += -std=c++0x

CPPFLAGS += -Wno-deprecated-declarations -Wno-unused-local-typedefs -Wno-unused-result -DBOOST_SYSTEM_NO_DEPRECATED=1

if EMBEDDED_LEVELDB
LEVELDB_CPPFLAGS += -I$(srcdir)/leveldb/include
Expand All @@ -24,6 +25,7 @@ BITCOIN_INCLUDES=-I$(builddir) -I$(builddir)/obj $(BOOST_CPPFLAGS) $(LEVELDB_CPP

BITCOIN_INCLUDES += -I$(srcdir)/secp256k1/include

LIBBITCOIN_ENTERPRISE=libbitcoin_enterprise.a
LIBBITCOIN_SERVER=libbitcoin_server.a
LIBBITCOIN_WALLET=libbitcoin_wallet.a
LIBBITCOIN_COMMON=libbitcoin_common.a
Expand All @@ -49,6 +51,7 @@ EXTRA_LIBRARIES = \
libbitcoin_util.a \
libbitcoin_common.a \
univalue/libbitcoin_univalue.a \
libbitcoin_enterprise.a \
libbitcoin_server.a \
libbitcoin_cli.a
if ENABLE_WALLET
Expand Down Expand Up @@ -125,6 +128,7 @@ BITCOIN_CORE_H = \
utils/utilparse.h \
rpc/rpcclient.h \
rpc/rpcprotocol.h \
rpc/rpcasio.h \
rpc/rpcutils.h \
rpc/rpcwallet.h \
rpc/rpcserver.h \
Expand Down Expand Up @@ -175,6 +179,16 @@ obj/build.h: FORCE
$(abs_top_srcdir)
libbitcoin_util_a-clientversion.$(OBJEXT): obj/build.h

if ENABLE_ENTERPRISE
-include enterprise/Makefile.am
else
libbitcoin_enterprise_a_CPPFLAGS = $(BITCOIN_INCLUDES)
libbitcoin_enterprise_a_SOURCES = \
community/community.cpp \
wallet/db.cpp \
wallet/dbwrap_com.cpp
endif

# server: shared between bitcoind and bitcoin-qt
libbitcoin_server_a_CPPFLAGS = $(BITCOIN_INCLUDES) $(MINIUPNPC_CPPFLAGS)
libbitcoin_server_a_SOURCES = \
Expand Down Expand Up @@ -224,8 +238,6 @@ libbitcoin_server_a_SOURCES = \
libbitcoin_wallet_a_CPPFLAGS = $(BITCOIN_INCLUDES)
libbitcoin_wallet_a_SOURCES = \
wallet/dbflat.cpp \
wallet/db.cpp \
wallet/dbwrap_com.cpp \
wallet/crypter.cpp \
rpc/rpcdump.cpp \
rpc/rpcwallet.cpp \
Expand Down Expand Up @@ -262,6 +274,9 @@ crypto_libbitcoin_crypto_a_SOURCES = \
crypto/sha1.h \
crypto/ripemd160.h




# multichain library
multichain_libbitcoin_multichain_a_CPPFLAGS = $(BITCOIN_CONFIG_INCLUDES)
multichain_libbitcoin_multichain_a_SOURCES = \
Expand Down Expand Up @@ -456,6 +471,7 @@ libbitcoin_v8_a_CPPFLAGS = $(BITCOIN_INCLUDES) $(V8_INCLUDE)

# multichaind binary #
multichaind_LDADD = \
$(LIBBITCOIN_ENTERPRISE) \
$(LIBBITCOIN_SERVER) \
$(LIBBITCOIN_COMMON) \
$(LIBBITCOIN_UNIVALUE) \
Expand Down Expand Up @@ -499,6 +515,7 @@ endif

# multichaind-cold binary #
multichaind_cold_LDADD = \
$(LIBBITCOIN_ENTERPRISE) \
$(LIBBITCOIN_SERVER) \
$(LIBBITCOIN_COMMON) \
$(LIBBITCOIN_UNIVALUE) \
Expand Down
9 changes: 7 additions & 2 deletions src/chainparams/buildgenesis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,12 @@ int mc_MultichainParams::Build(const unsigned char* pubkey, int pubkey_size)
uint32_t nBits,timestamp;
int i;
const unsigned char *ptr;
const unsigned char *pubkey_hash=(unsigned char *)Hash160(pubkey,pubkey+pubkey_size).begin();
// const unsigned char *pubkey_hash=(unsigned char *)Hash160(pubkey,pubkey+pubkey_size).begin();

unsigned char pubkey_hash[20];
uint160 pkhash=Hash160(pubkey,pubkey+pubkey_size);
memcpy(pubkey_hash,&pkhash,20);

size_t elem_size;
const unsigned char *elem;
int root_stream_name_size;
Expand Down Expand Up @@ -271,7 +276,7 @@ int mc_MultichainParams::Build(const unsigned char* pubkey, int pubkey_size)
{
return err;
}


CalculateHash(hash);

Expand Down
8 changes: 1 addition & 7 deletions src/core/init-cold.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ std::string HelpMessage_Cold()
strUsage += " -salvagewallet " + _("Attempt to recover private keys from a corrupt wallet.dat") + " " + _("on startup") + "\n";
strUsage += " -wallet=<file> " + _("Specify wallet file (within data directory)") + " " + strprintf(_("(default: %s)"), "wallet.dat") + "\n";
/* MCHN START */
strUsage += " -walletdbversion=1|2 " + _("Specify wallet version, 1 - not scalable, 2 (default) - scalable") + "\n";
strUsage += " -walletdbversion=2|3 " + _("Specify wallet version, 2 - Berkeley DB, 3 (default) - proprietary") + "\n";
/* MCHN END */
#endif

Expand Down Expand Up @@ -608,33 +608,27 @@ bool AppInit2_Cold(boost::thread_group& threadGroup,int OutputPipe)
return InitError(_(seed_error.c_str()));
}

bool wallet_mode_valid=false;
wallet_mode=GetArg("-walletdbversion",0);
if(wallet_mode == 0)
{
mc_gState->m_WalletMode=MC_WMD_AUTO;
wallet_mode_valid=true;
}
if(wallet_mode == 3)
{
mc_gState->m_WalletMode=MC_WMD_TXS | MC_WMD_ADDRESS_TXS | MC_WMD_FLAT_DAT_FILE;
wallet_mode_valid=true;
}
if(wallet_mode == 2)
{
mc_gState->m_WalletMode=MC_WMD_TXS | MC_WMD_ADDRESS_TXS;
wallet_mode_valid=true;
}
if(wallet_mode == 1)
{
mc_gState->m_WalletMode=MC_WMD_NONE;
wallet_mode_valid=true;
zap_wallet_txs=false;
}
if(wallet_mode == -1)
{
mc_gState->m_WalletMode=MC_WMD_TXS | MC_WMD_ADDRESS_TXS | MC_WMD_MAP_TXS;
wallet_mode_valid=true;
zap_wallet_txs=false;
}

Expand Down
16 changes: 9 additions & 7 deletions src/core/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ mc_WalletTxs* pwalletTxsMain = NULL;
mc_RelayManager* pRelayManager = NULL;
mc_FilterEngine* pFilterEngine = NULL;
mc_MultiChainFilterEngine* pMultiChainFilterEngine = NULL;

bool fFeeEstimatesInitialized = false;
extern int JSON_DOUBLE_DECIMAL_DIGITS;

Expand All @@ -92,6 +93,11 @@ enum BindFlags {
static const char* FEE_ESTIMATES_FILENAME="fee_estimates.dat";
CClientUIInterface uiInterface;

//! -paytxfee will warn if called with a higher fee than this amount (in satoshis) per KB
static const CAmount nHighTransactionFeeWarning = 0.01 * COIN;
//! -maxtxfee will warn if called with a higher fee than this amount (in satoshis)
static const CAmount nHighTransactionMaxFeeWarning = 100 * nHighTransactionFeeWarning;

//////////////////////////////////////////////////////////////////////////////
//
// Shutdown
Expand Down Expand Up @@ -218,6 +224,7 @@ void Shutdown()
delete pwalletMain;
pwalletMain = NULL;
/* MCHN START */

if(pwalletTxsMain)
{
delete pwalletTxsMain;
Expand All @@ -234,6 +241,7 @@ void Shutdown()
delete pMultiChainFilterEngine;
pMultiChainFilterEngine=NULL;
}


if(pFilterEngine)
{
Expand Down Expand Up @@ -414,7 +422,7 @@ std::string HelpMessage(HelpMessageMode mode)
strUsage += " -walletnotifynew=<cmd> " + _("Execute this command when a transaction is first seen, if it relates to an address in the wallet or a subscribed asset or stream. ") + "\n";
strUsage += " " + _("(more details and % substitutions online)") + "\n";
/* MCHN START */
strUsage += " -walletdbversion=1|2 " + _("Specify wallet version, 1 - not scalable, 2 (default) - scalable") + "\n";
strUsage += " -walletdbversion=2|3 " + _("Specify wallet version, 2 - Berkeley DB, 3 (default) - proprietary") + "\n";
strUsage += " -autosubscribe=streams|assets|\"streams,assets\"|\"assets,streams\" " + _("Automatically subscribe to new streams and/or assets") + "\n";
/* MCHN END */
strUsage += " -zapwallettxes=<mode> " + _("Delete all wallet transactions and only recover those parts of the blockchain through -rescan on startup") + "\n";
Expand Down Expand Up @@ -1444,34 +1452,28 @@ bool AppInit2(boost::thread_group& threadGroup,int OutputPipe)
string strBurnAddress=BurnAddress(Params().Base58Prefix(CChainParams::PUBKEY_ADDRESS)); // Caching burn address
LogPrint("mchn","mchn: Burn address: %s\n",strBurnAddress.c_str());

bool wallet_mode_valid=false;
wallet_mode=GetArg("-walletdbversion",0);
if(wallet_mode == 0)
{
mc_gState->m_WalletMode=MC_WMD_AUTO;
wallet_mode_valid=true;
}
if(wallet_mode == 3)
{
mc_gState->m_WalletMode=MC_WMD_TXS | MC_WMD_ADDRESS_TXS | MC_WMD_FLAT_DAT_FILE;
wallet_mode_valid=true;
}
if(wallet_mode == 2)
{
mc_gState->m_WalletMode=MC_WMD_TXS | MC_WMD_ADDRESS_TXS;
wallet_mode_valid=true;
}

if(wallet_mode == 1)
{
mc_gState->m_WalletMode=MC_WMD_NONE;
wallet_mode_valid=true;
zap_wallet_txs=false;
}
if(wallet_mode == -1)
{
mc_gState->m_WalletMode=MC_WMD_TXS | MC_WMD_ADDRESS_TXS | MC_WMD_MAP_TXS;
wallet_mode_valid=true;
zap_wallet_txs=false;
}

Expand Down
2 changes: 2 additions & 0 deletions src/core/init.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ struct mc_WalletTxs;
struct mc_RelayManager;
struct mc_FilterEngine;
struct mc_MultiChainFilterEngine;
struct mc_EnterpriseFeatures;

namespace boost
{
Expand All @@ -25,6 +26,7 @@ extern mc_WalletTxs* pwalletTxsMain;
extern mc_RelayManager* pRelayManager;
extern mc_FilterEngine* pFilterEngine;
extern mc_MultiChainFilterEngine* pMultiChainFilterEngine;
extern mc_EnterpriseFeatures* pEF;


void StartShutdown();
Expand Down
87 changes: 0 additions & 87 deletions src/core/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -537,93 +537,6 @@ int MultichainNode_ApplyUpgrades(int current_height)
}


int MultichainNode_ApplyUpgrades_Old(int current_height)
{
mc_EntityDetails entity;
mc_Buffer *permissions;
permissions=NULL;
map <uint64_t,int> map_sorted;

int OriginalProtocolVersion=(int)mc_gState->m_NetworkParams->GetInt64Param("protocolversion");
int CurrentProtocolVersion=mc_gState->m_NetworkParams->ProtocolVersion();//mc_gState->m_ProtocolVersionToUpgrade;
int NewProtocolVersion=OriginalProtocolVersion;
int version;

permissions=mc_gState->m_Permissions->GetUpgradeList(NULL,NULL);

for(int i=0;i<permissions->GetCount();i++)
{
mc_PermissionDetails *plsRow;
plsRow=(mc_PermissionDetails *)(permissions->GetRow(i));
if(plsRow->m_Type == MC_PTP_UPGRADE)
{
map_sorted.insert(std::make_pair(plsRow->m_LastRow,i));
}
}

BOOST_FOREACH(PAIRTYPE(const uint64_t, int)& item, map_sorted)
// for(int i=0;i<upgrades->GetCount();i++)
{
int i=item.second;
mc_PermissionDetails *plsRow;
plsRow=(mc_PermissionDetails *)(permissions->GetRow(i));
if(plsRow->m_Type == MC_PTP_UPGRADE)
{
if(plsRow->m_BlockFrom < plsRow->m_BlockTo)
{
if(mc_gState->m_Assets->FindEntityByShortTxID(&entity,plsRow->m_Address))
{
int applied_height=entity.UpgradeStartBlock();
if((int)plsRow->m_BlockReceived > applied_height)
{
applied_height=plsRow->m_BlockReceived;
}
if(current_height >=applied_height)
{
version=entity.UpgradeProtocolVersion();
if(version >= mc_gState->MinProtocolDowngradeVersion())
{
if((NewProtocolVersion < mc_gState->MinProtocolForbiddenDowngradeVersion()) || (version >= NewProtocolVersion))
{
NewProtocolVersion=version;
}
}
}
}
}
}
}

mc_gState->m_Permissions->FreePermissionList(permissions);
mc_gState->m_ProtocolVersionToUpgrade=NewProtocolVersion;

if(mc_gState->m_ProtocolVersionToUpgrade != CurrentProtocolVersion)
{
LogPrintf("New protocol upgrade version: %d (was %d)\n",mc_gState->m_ProtocolVersionToUpgrade,CurrentProtocolVersion);
// if(mc_gState->m_ProtocolVersionToUpgrade > mc_gState->GetProtocolVersion())
if( (mc_gState->m_ProtocolVersionToUpgrade > 0) && (mc_gState->IsSupported(mc_gState->m_ProtocolVersionToUpgrade) == 0) )
{
LogPrintf("NODE SHOULD BE UPGRADED FROM %d TO %d\n",mc_gState->GetProtocolVersion(),mc_gState->m_ProtocolVersionToUpgrade);
}
else
{
if(mc_gState->m_ProtocolVersionToUpgrade != mc_gState->m_NetworkParams->ProtocolVersion())
{
LogPrintf("NODE IS UPGRADED FROM %d TO %d\n",mc_gState->m_NetworkParams->ProtocolVersion(),mc_gState->m_ProtocolVersionToUpgrade);
mc_gState->m_NetworkParams->m_ProtocolVersion=mc_gState->m_ProtocolVersionToUpgrade;// UPGRADE CODE HERE
mc_gState->m_NetworkParams->SetGlobals();
SetMultiChainParams();
}
}
}
else
{
mc_gState->m_ProtocolVersionToUpgrade=0;
}

return MC_ERR_NOERROR;
}

void MultichainNode_UpdateBlockByHeightList(CBlockIndex *pindex)
{
if(pindex->nHeight < 0)
Expand Down
Loading

0 comments on commit bd96480

Please sign in to comment.