diff --git a/INSTALL.md b/INSTALL.md index 0c4095e5c..0b2f084e7 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -4,7 +4,7 @@ To install a Debian package: - dpkg -i hush-3.5.0-amd4.deb + dpkg -i hush-3.6.2-amd4.deb To uninstall: @@ -42,6 +42,18 @@ cd hush3 ./build.sh -j$(nproc) ``` +## Building On Ubuntu 16.04 and older systems + +Some older compilers may not be able to compile modern code, such as gcc 5.4 which comes with Ubuntu 16.04 by default. Here is how to install gcc 7 on Ubuntu 16.04. Run these commands as root: + +``` +add-apt-repository ppa:ubuntu-toolchain-r/test && \ +apt update && \ +apt-get install -y gcc-7 g++-7 && \ + update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 60 && \ + update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 60 +``` + ## Run a HUSH Node ```sh diff --git a/configure.ac b/configure.ac index 3156d09e7..216f612bf 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N) AC_PREREQ([2.60]) define(_CLIENT_VERSION_MAJOR, 3) define(_CLIENT_VERSION_MINOR, 6) -define(_CLIENT_VERSION_REVISION, 2) +define(_CLIENT_VERSION_REVISION, 3) define(_CLIENT_VERSION_BUILD, 50) define(_ZC_BUILD_VAL, m4_if(m4_eval(_CLIENT_VERSION_BUILD < 25), 1, m4_incr(_CLIENT_VERSION_BUILD), m4_eval(_CLIENT_VERSION_BUILD < 50), 1, m4_eval(_CLIENT_VERSION_BUILD - 24), m4_eval(_CLIENT_VERSION_BUILD == 50), 1, , m4_eval(_CLIENT_VERSION_BUILD - 50))) define(_CLIENT_VERSION_SUFFIX, m4_if(m4_eval(_CLIENT_VERSION_BUILD < 25), 1, _CLIENT_VERSION_REVISION-beta$1, m4_eval(_CLIENT_VERSION_BUILD < 50), 1, _CLIENT_VERSION_REVISION-rc$1, m4_eval(_CLIENT_VERSION_BUILD == 50), 1, _CLIENT_VERSION_REVISION, _CLIENT_VERSION_REVISION-$1))) diff --git a/contrib/devtools/gen-linux-binary-release.sh b/contrib/devtools/gen-linux-binary-release.sh index a8ae359cb..07e7af868 100755 --- a/contrib/devtools/gen-linux-binary-release.sh +++ b/contrib/devtools/gen-linux-binary-release.sh @@ -1,15 +1,23 @@ #!/bin/bash -# Copyright (c) 2016-2020 The Hush developers +# Copyright (c) 2016-2021 The Hush developers # Released under the GPLv3 +set -e +set -x + #TODO: autodect version number, error handling -FILE="hush-3.6.0-linux-amd64.tar" +FILE="hush-3.6.2-linux-amd64.tar" +TIME=$(perl -e 'print time') +mv build build.$TIME mkdir build +cp contrib/asmap/asmap.dat build/ cp sapling*.params build/ cd src cp komodod komodo-cli komodo-tx hushd hush-cli hush-tx hush-smart-chain ../build cd ../build +strip komodo* tar -f $FILE -c * -gzip $FILE - +gzip -9 $FILE +sha256sum *.gz +du -sh *.gz diff --git a/depends/packages/wolfssl.mk b/depends/packages/wolfssl.mk index 07f235838..d1e9ac08c 100644 --- a/depends/packages/wolfssl.mk +++ b/depends/packages/wolfssl.mk @@ -50,7 +50,7 @@ endef #endef define $(package)_build_cmds - $(MAKE) -j1 src/libwolfssl.la + $(MAKE) CPPFLAGS='-fPIC' -j1 src/libwolfssl.la endef define $(package)_stage_cmds diff --git a/src/Makefile.am b/src/Makefile.am index 1eb56ec24..0711b52cc 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,4 +1,4 @@ -# Copyright 2016-2020 The Hush developers +# Copyright 2016-2021 The Hush developers # Distributed under the GPLv3 software license, see the accompanying # file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html @@ -483,8 +483,8 @@ nodist_libbitcoin_util_a_SOURCES = $(srcdir)/obj/build.h # komodod binary # komodod_SOURCES = bitcoind.cpp -komodod_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) -komodod_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) +komodod_CPPFLAGS = -fPIC $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) +komodod_CXXFLAGS = -fPIC $(AM_CXXFLAGS) $(PIE_FLAGS) komodod_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) if TARGET_WINDOWS diff --git a/src/clientversion.h b/src/clientversion.h index 98075253d..b2f606f64 100644 --- a/src/clientversion.h +++ b/src/clientversion.h @@ -1,6 +1,6 @@ // Copyright (c) 2009-2014 The Bitcoin Core developers // Copyright (c) 2016-2017 The Zcash developers -// Copyright (c) 2016-2020 The Hush developers +// Copyright (c) 2016-2021 The Hush developers // Distributed under the GPLv3 software license, see the accompanying // file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html /****************************************************************************** @@ -29,7 +29,7 @@ // Must be kept in sync with configure.ac , ugh! #define CLIENT_VERSION_MAJOR 3 #define CLIENT_VERSION_MINOR 6 -#define CLIENT_VERSION_REVISION 2 +#define CLIENT_VERSION_REVISION 3 #define CLIENT_VERSION_BUILD 50 //! Set to true for release, false for prerelease or test build diff --git a/src/init.cpp b/src/init.cpp index 7ecfe9dbd..2624945bf 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1,8 +1,10 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2014 The Bitcoin Core developers -// Copyright (c) 2016-2020 The Hush developers +// Copyright (c) 2016-2021 The Hush developers // Distributed under the GPLv3 software license, see the accompanying // file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html +// What happened to the SuperNET devs, who were dedicated to privacy??? +// Did they go the way of the dodo when they embraced KYC? /****************************************************************************** * Copyright © 2014-2019 The SuperNET Developers. * * * @@ -1095,13 +1097,52 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) fs::path pwd = fs::path(cwd); fs::path contrib = pwd / ".." / "contrib" / "asmap"; - // if no filepath, use the default in contrib + // If no asmap given (default), look for one + // First we look in PWD, the most common case (binaries) + // Then we look in /usr/share/hush, for Debian packages + // then we look in ../contrib/asmap/ for compiling from source case + // finally we try the parent directory .. as a last resort + // if no asmap can be found, something is wrong, and we exit if (asmap_path.empty()) { - asmap_path = contrib / DEFAULT_ASMAP_FILENAME; - } - if (!asmap_path.is_absolute()) { - asmap_path = GetDataDir() / asmap_path; + // Most binaries will have it in PWD + asmap_path = pwd / DEFAULT_ASMAP_FILENAME; + printf("%s: looking for asmap file at %s\n", __func__, asmap_path.c_str() ); + if(fs::exists(asmap_path)) { + printf("%s: found asmap file at %s\n", __func__, asmap_path.c_str() ); + } else { + // Debian Packages + asmap_path = fs::path("/usr/share/hush") / DEFAULT_ASMAP_FILENAME; + printf("%s: looking for asmap file at %s\n", __func__, asmap_path.c_str() ); + if(fs::exists(asmap_path)) { + printf("%s: found asmap file at %s\n", __func__, asmap_path.c_str() ); + } else { + // Source code + asmap_path = contrib / DEFAULT_ASMAP_FILENAME; + printf("%s: looking for asmap file at %s\n", __func__, asmap_path.c_str() ); + if(fs::exists(asmap_path)) { + printf("%s: found asmap file at %s\n", __func__, asmap_path.c_str() ); + } else { + // Last Resort: Check the parent directory + asmap_path = pwd / ".." / DEFAULT_ASMAP_FILENAME; + printf("%s: looking for asmap file at %s\n", __func__, asmap_path.c_str() ); + if(fs::exists(asmap_path)) { + printf("%s: found asmap file at %s\n", __func__, asmap_path.c_str() ); + } else { + // Shit is fucked up, die an honorable death + InitError(strprintf(_("Could not find any asmap file! Please report this bug to Hush Developers"))); + return false; + } + } + } + } + } else { + if (!asmap_path.is_absolute()) { + asmap_path = GetDataDir() / asmap_path; + } + printf("%s: looking for custom asmap file at %s\n", __func__, asmap_path.c_str() ); } + + //TODO: verify asmap_path is not a directory if (!fs::exists(asmap_path)) { InitError(strprintf(_("Could not find asmap file %s"), asmap_path)); return false; @@ -1113,8 +1154,8 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) } const uint256 asmap_version = SerializeHash(asmap); printf("%s: asmap version=%s with %lu mappings\n", __func__, asmap_version.ToString().c_str(), asmap.size()); + LogPrintf("Using asmap version %s for IP bucketing with %lu mappings\n", asmap_version.ToString(), asmap.size()); addrman.m_asmap = std::move(asmap); // //node.connman->SetAsmap(std::move(asmap)); - LogPrintf("Using asmap version %s for IP bucketing\n", asmap_version.ToString()); } else { LogPrintf("Using /16 prefix for IP bucketing, but why?\n"); diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp index 948ad2eae..1914aa8df 100644 --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2010 Satoshi Nakamoto // Copyright (c) 2009-2015 The Bitcoin Core developers -// Copyright (c) 2016-2020 The Hush developers +// Copyright (c) 2016-2021 The Hush developers // Distributed under the GPLv3 software license, see the accompanying // file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html /****************************************************************************** @@ -1266,7 +1266,7 @@ UniValue sendrawtransaction(const UniValue& params, bool fHelp, const CPubKey& m if (fMissingInputs) { throw JSONRPCError(RPC_TRANSACTION_ERROR, "Missing inputs"); } - throw JSONRPCError(RPC_TRANSACTION_ERROR, state.GetRejectReason()); + throw JSONRPCError(RPC_TRANSACTION_ERROR, strprintf("Invalid state: %s", state.GetRejectReason())); } } } else if (fHaveChain) { @@ -1274,9 +1274,7 @@ UniValue sendrawtransaction(const UniValue& params, bool fHelp, const CPubKey& m } LogPrintf("%s: Relaying raw tx to mempool\n", __FUNCTION__); RelayTransaction(tx); - } - else - { + } else { NSPV_broadcast((char *)params[0].get_str().c_str()); } return hashTx.GetHex(); diff --git a/src/version.h b/src/version.h index 69c48d1a4..bc304b404 100644 --- a/src/version.h +++ b/src/version.h @@ -1,5 +1,5 @@ // Copyright (c) 2012-2014 The Bitcoin Core developers -// Copyright (c) 2016-2020 The Hush developers +// Copyright (c) 2016-2021 The Hush developers // Distributed under the GPLv3 software license, see the accompanying // file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html /****************************************************************************** @@ -21,7 +21,7 @@ #define HUSH_VERSION_H // network protocol versioning -static const int PROTOCOL_VERSION = 1987420; +static const int PROTOCOL_VERSION = 1987421; //! initial proto version, to be increased after version/verack negotiation static const int INIT_PROTO_VERSION = 209; //! In this version, 'getheaders' was introduced. diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index feb0788ff..7f49b9a3b 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1473,7 +1473,7 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn, bool fFromLoadWallet, CWalletD } //// debug print - LogPrintf("AddToWallet %s %s%s\n", wtxIn.GetHash().ToString(), (fInsertedNew ? "new" : ""), (fUpdated ? "update" : "")); + LogPrintf("AddToWallet %s at height %d %s%s\n", wtxIn.GetHash().ToString(), hush_blockheight(wtxIn.hashBlock), (fInsertedNew ? "new" : ""), (fUpdated ? "update" : "")); // Write to disk if (fInsertedNew || fUpdated) diff --git a/zcutil/build-debian-package.sh b/zcutil/build-debian-package.sh index 629a053d4..421129702 100755 --- a/zcutil/build-debian-package.sh +++ b/zcutil/build-debian-package.sh @@ -45,6 +45,7 @@ chmod 0755 -R $BUILD_DIR/* #cp $SRC_DEB/prerm $BUILD_DIR/DEBIAN # Copy binaries. We prefix our komodod binaries with hush- to prevent conflicting with # a stock komodod or other flavors of KMD +cp $SRC_PATH/contrib/asmap/asmap.dat $DEB_SHR cp $SRC_PATH/sapling-spend.params $DEB_SHR cp $SRC_PATH/sapling-output.params $DEB_SHR cp $SRC_PATH/src/komodod $DEB_BIN/hush-komodod