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 19, 2019
2 parents bd96480 + aa99fb0 commit 032b6b1
Show file tree
Hide file tree
Showing 29 changed files with 561 additions and 91 deletions.
12 changes: 8 additions & 4 deletions V8_mac.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ MultiChain uses V8 version 6.8, and requires at least 4 GB of RAM to build in a

## Clone Google's depot_tools

Google's [depot_tools](http://dev.chromium.org/developers/how-tos/install-depot-tools) are used by the Google build system to manage Git checkouts.
Google's [depot_tools](https://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up) are used by the Google build system to manage Git checkouts.

git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
cd depot_tools
Expand Down Expand Up @@ -38,12 +38,12 @@ The selected release of the V8 sources requires relaxing two compiler checks to

- Open the file `build/config/compiler/BUILD.gn` in your favorite editor.

- Locate the folllowing lines (currently at **1464**):
- Locate the following lines (currently at **1469**):

if (is_clang) {
cflags += [
- Add the following two lines to **the end** of the block and save the file:
- Add the following two lines to **the end of the block** and save the file:

"-Wno-defaulted-function-deleted",
"-Wno-null-pointer-arithmetic",
Expand All @@ -55,7 +55,11 @@ Build the V8 libraries:

Create an additional library embedding the V8 initial snapshot blobs:

brew install python
brew install python@2
pip install pathlib2
cd $RELEASE
python $MULTICHAIN_HOME/depends/v8_data_lib.py

### Note

The environment variable `$MULTICHAIN_HOME` should point to the parent of the V8 build folder (see [mac.md](mac.md) for details).
63 changes: 37 additions & 26 deletions mac.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,49 @@
# Mac Build Notes (on MacOS Sierra)

## Install dependencies
## Install XCode and XCode command line tools

- Test if XCode command line tools are installed:

xcode-select -p

- If the command does not print the location of the XCode command-line tools successfully:

xcode-select --install
- Select XCode locatioh:

sudo xcode-select -s <path/to/Xcode.app>

- Install brew (follow instructions on [brew.sh](https://brew.sh/))

## Clone MultiChain
Install git from git-scm, then

Install XCode and XCode command line tools
git clone https://github.com/MultiChain/multichain.git


## Prepare to download or build V8

cd multichain
set MULTICHAIN_HOME=$(pwd)
mkdir v8build
cd v8build

Install git from git-scm

You can use pre-built headers and binaries of Google's V8 JavaScript engine by downloading and expanding [macos-v8.tar.gz](https://github.com/MultiChain/multichain-binaries/raw/master/macos-v8.tar.gz) in the current directory. If, on the other hand, you prefer to build the V8 component yourself, please follow the instructions in [V8_mac.md](/V8_mac.md/).

Install brew (follow instructions on brew.sh)
## Install dependencies

brew install autoconf automake berkeley-db4 libtool boost@1.57 openssl pkg-config rename python@2
brew install autoconf automake berkeley-db4 libtool boost@1.57 pkg-config rename python@2 nasm
export LDFLAGS=-L/usr/local/opt/openssl/lib
export CPPFLAGS=-I/usr/local/opt/openssl/include
brew link boost@1.57 --force

If another Boost version was already installed, then do this:

brew uninstall boost
brew install boost@1.57
brew link boost@1.57 --force

The following command may be necessary if XCode was not used yet:

sudo xcode-select -s /Applications/Xcode.app

## Prepare for static linking

Expand All @@ -45,26 +69,13 @@ The default brew cookbook for berkeley-db and boost builds static libraries, but

brew edit openssl
In 'def configure_args' change 'shared' to 'no-shared'
In 'def install' => 'args =' change 'shared' to 'no-shared'

brew install openssl --force
<!--
export LDFLAGS=-L/usr/local/opt/openssl/lib
export CPPFLAGS=-I/usr/local/opt/openssl/include

## Clone MultiChain

git clone https://github.com/MultiChain/multichain.git


## Prepare to download or build V8

cd multichain
set MULTICHAIN_HOME=$(pwd)
mkdir v8build
cd v8build


You can use pre-built headers and binaries of Google's V8 JavaScript engine by downloading and expanding [macos-v8.tar.gz](https://github.com/MultiChain/multichain-binaries/raw/master/macos-v8.tar.gz) in the current directory. If, on the other hand, you prefer to build the V8 component yourself, please follow the instructions in [V8_mac.md](/V8_mac.md/).
-->

## Compile MultiChain for Mac (64-bit)

Expand All @@ -80,7 +91,7 @@ You can use pre-built headers and binaries of Google's V8 JavaScript engine by d
rename -e 's/.dylib.hidden/.dylib/' /usr/local/opt/openssl/lib/*.dylib.hidden
brew edit openssl

In 'def configure_args' change 'no-shared' to 'shared'
In 'def install' => 'args =' change 'no-shared' to 'shared'

## Notes

Expand Down
9 changes: 5 additions & 4 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ 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 @@ -180,8 +179,10 @@ obj/build.h: FORCE
libbitcoin_util_a-clientversion.$(OBJEXT): obj/build.h

if ENABLE_ENTERPRISE
-include enterprise/Makefile.am
EXTRA_LIBRARIES += libbitcoin_enterprise.a
include entMakefile.am
else
EXTRA_LIBRARIES += libbitcoin_enterprise.a
libbitcoin_enterprise_a_CPPFLAGS = $(BITCOIN_INCLUDES)
libbitcoin_enterprise_a_SOURCES = \
community/community.cpp \
Expand Down Expand Up @@ -471,11 +472,11 @@ libbitcoin_v8_a_CPPFLAGS = $(BITCOIN_INCLUDES) $(V8_INCLUDE)

# multichaind binary #
multichaind_LDADD = \
$(LIBBITCOIN_ENTERPRISE) \
$(LIBBITCOIN_SERVER) \
$(LIBBITCOIN_COMMON) \
$(LIBBITCOIN_UNIVALUE) \
$(LIBBITCOIN_WALLET) \
$(LIBBITCOIN_ENTERPRISE) \
$(LIBBITCOIN_MULTICHAIN) \
$(LIBBITCOIN_UTIL) \
$(LIBBITCOIN_CRYPTO) \
Expand Down Expand Up @@ -515,11 +516,11 @@ endif

# multichaind-cold binary #
multichaind_cold_LDADD = \
$(LIBBITCOIN_ENTERPRISE) \
$(LIBBITCOIN_SERVER) \
$(LIBBITCOIN_COMMON) \
$(LIBBITCOIN_UNIVALUE) \
$(LIBBITCOIN_WALLET) \
$(LIBBITCOIN_ENTERPRISE) \
$(LIBBITCOIN_MULTICHAIN) \
$(LIBBITCOIN_UTIL) \
$(LIBBITCOIN_CRYPTO) \
Expand Down
1 change: 1 addition & 0 deletions src/chainparams/state.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ typedef struct mc_Params
char** m_Arguments;
int m_FirstArgumentType;
char m_DataDirNetSpecific[MC_DCT_DB_MAX_PATH];
char m_LogDirNetSpecific[MC_DCT_DB_MAX_PATH];
char m_DataDir[MC_DCT_DB_MAX_PATH];

mc_Params()
Expand Down
11 changes: 6 additions & 5 deletions src/core/init-cold.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,9 @@ void Shutdown_Cold()
if (pwalletMain)
bitdbwrap.Flush(true);
#endif
#ifndef WIN32
//#ifndef WIN32
boost::filesystem::remove(GetPidFile());
#endif
//#endif
#ifdef ENABLE_WALLET
delete pwalletMain;
pwalletMain = NULL;
Expand Down Expand Up @@ -226,6 +226,7 @@ std::string HelpMessage_Cold()
strUsage += ".\n";

strUsage += " -printtoconsole " + _("Send trace/debug info to console instead of debug.log file") + "\n";
strUsage += " -logdir " + _("Send trace/debug info to specified directory") + "\n";
strUsage += " -shrinkdebugfile " + _("Shrink debug.log file on client startup (default: 1 when no -debug)") + "\n";

strUsage += "\n" + _("RPC server options:") + "\n";
Expand Down Expand Up @@ -393,9 +394,9 @@ bool AppInit2_Cold(boost::thread_group& threadGroup,int OutputPipe)
#endif
/* MCHN END */

#ifndef WIN32
CreatePidFile(GetPidFile(), getpid());
#endif
//#ifndef WIN32
CreatePidFile(GetPidFile(), __US_GetPID());
//#endif
if (GetBoolArg("-shrinkdebugfile", !fDebug))
ShrinkDebugFile();
LogPrintf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
Expand Down
11 changes: 6 additions & 5 deletions src/core/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,9 @@ void Shutdown()
if (pwalletMain)
bitdbwrap.Flush(true);
#endif
#ifndef WIN32
//#ifndef WIN32
boost::filesystem::remove(GetPidFile());
#endif
//#endif
UnregisterAllValidationInterfaces();
#ifdef ENABLE_WALLET
delete pwalletMain;
Expand Down Expand Up @@ -463,6 +463,7 @@ std::string HelpMessage(HelpMessageMode mode)
}
strUsage += " -minrelaytxfee=<amt> " + strprintf(_("Fees (in BTC/Kb) smaller than this are considered zero fee for relaying (default: %s)"), FormatMoney(::minRelayTxFee.GetFeePerK())) + "\n";
strUsage += " -printtoconsole " + _("Send trace/debug info to console instead of debug.log file") + "\n";
strUsage += " -logdir " + _("Send trace/debug info to specified directory") + "\n";
if (GetBoolArg("-help-debug", false))
{
strUsage += " -printpriority " + strprintf(_("Log transaction priority and fee per kB when mining blocks (default: %u)"), 0) + "\n";
Expand Down Expand Up @@ -938,9 +939,9 @@ bool AppInit2(boost::thread_group& threadGroup,int OutputPipe)
#endif
/* MCHN END */

#ifndef WIN32
CreatePidFile(GetPidFile(), getpid());
#endif
//#ifndef WIN32
CreatePidFile(GetPidFile(), __US_GetPID());
//#endif
if (GetBoolArg("-shrinkdebugfile", !fDebug))
ShrinkDebugFile();
LogPrintf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
Expand Down
1 change: 1 addition & 0 deletions src/entMakefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

19 changes: 19 additions & 0 deletions src/multichain/multichaind-cold.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,19 @@ bool mc_DoesParentDataDirExist()
return true;
}

bool mc_DoesParentLogDirExist()
{
if (mapArgs.count("-logdir"))
{
boost::filesystem::path path=boost::filesystem::system_complete(mapArgs["-logdir"]);
if (!boost::filesystem::is_directory(path))
{
return false;
}
}
return true;
}

//////////////////////////////////////////////////////////////////////////////
//
// Start
Expand Down Expand Up @@ -102,6 +115,12 @@ bool AppInit(int argc, char* argv[])
return false;
}

if(!mc_DoesParentLogDirExist())
{
fprintf(stderr,"\nError: Log directory %s needs to exist before calling multichaind-cold. Exiting...\n\n",mapArgs["-logdir"].c_str());
return false;
}


mc_gState->m_Params->HasOption("-?");

Expand Down
30 changes: 26 additions & 4 deletions src/multichain/multichaind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,20 @@ bool mc_DoesParentDataDirExist()
return true;
}

bool mc_DoesParentLogDirExist()
{
if (mapArgs.count("-logdir"))
{
boost::filesystem::path path=boost::filesystem::system_complete(mapArgs["-logdir"]);
if (!boost::filesystem::is_directory(path))
{
return false;
}
}
return true;
}


//////////////////////////////////////////////////////////////////////////////
//
// Start
Expand Down Expand Up @@ -103,6 +117,11 @@ bool AppInit(int argc, char* argv[])
return false;
}

if(!mc_DoesParentLogDirExist())
{
fprintf(stderr,"\nError: Log directory %s needs to exist before calling multichaind. Exiting...\n\n",mapArgs["-logdir"].c_str());
return false;
}

pEF=new mc_EnterpriseFeatures;
if(pEF->Initialize(mc_gState->m_Params->NetworkName(),0))
Expand All @@ -111,11 +130,11 @@ bool AppInit(int argc, char* argv[])
delete mc_gState;
return false;
}

string edition=pEF->ENT_Edition();
if(edition.size())
{
edition=", "+edition+" Edition";
edition=edition+" Edition, ";
}


Expand All @@ -127,7 +146,7 @@ bool AppInit(int argc, char* argv[])
mc_gState->m_Params->HasOption("-version") ||
(mc_gState->m_Params->NetworkName() == NULL))
{
fprintf(stdout,"\nMultiChain %s Daemon%s (protocol %s)\n\n",mc_BuildDescription(mc_gState->GetNumericVersion()).c_str(),edition.c_str(),mc_SupportedProtocols().c_str());
fprintf(stdout,"\nMultiChain %s Daemon (%sprotocol %s)\n\n",mc_BuildDescription(mc_gState->GetNumericVersion()).c_str(),edition.c_str(),mc_SupportedProtocols().c_str());
std::string strUsage = "";
if (mc_gState->m_Params->HasOption("-version"))
{
Expand All @@ -150,7 +169,7 @@ bool AppInit(int argc, char* argv[])

if(!GetBoolArg("-shortoutput", false))
{
fprintf(stdout,"\nMultiChain %s Daemon%s (latest protocol %d)\n\n",mc_BuildDescription(mc_gState->GetNumericVersion()).c_str(),edition.c_str(),mc_gState->GetProtocolVersion());
fprintf(stdout,"\nMultiChain %s Daemon (%slatest protocol %d)\n\n",mc_BuildDescription(mc_gState->GetNumericVersion()).c_str(),edition.c_str(),mc_gState->GetProtocolVersion());
}

pipes[1]=STDOUT_FILENO;
Expand Down Expand Up @@ -217,6 +236,9 @@ bool AppInit(int argc, char* argv[])

mc_gState->m_Params->Parse(argc, argv, MC_ETP_DAEMON);
mc_CheckDataDirInConfFile();

pEF=new mc_EnterpriseFeatures;
pEF->Initialize(mc_gState->m_Params->NetworkName(),0);
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/permissions/permission.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ int mc_Permissions::Initialize(const char *name,int mode)

m_Ledger->SetName(name);
m_Database->SetName(name);
mc_GetFullFileName(name,"permissions",".log",MC_FOM_RELATIVE_TO_DATADIR,m_LogFileName);
mc_GetFullFileName(name,"permissions",".log",MC_FOM_RELATIVE_TO_LOGDIR | MC_FOM_CREATE_DIR,m_LogFileName);

err=m_Database->Open();

Expand Down
3 changes: 3 additions & 0 deletions src/rpc/rpcclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,9 @@ static const CRPCConvertParam vRPCConvertParams[] =
{ "gettxoutdata", 1 },
{ "gettxoutdata", 2 },
{ "gettxoutdata", 3 },
{ "txouttobinarycache", 2 },
{ "txouttobinarycache", 3 },
{ "txouttobinarycache", 4 },
{ "liststreamkeys", 1 },
{ "liststreamkeys", 2 },
{ "liststreamkeys", 3 },
Expand Down
Loading

0 comments on commit 032b6b1

Please sign in to comment.