Skip to content

Commit

Permalink
Merge pull request #411 from vergecurrency/tor_integration
Browse files Browse the repository at this point in the history
Tor integration, move to 4.0.1
  • Loading branch information
justinvforvendetta authored Jan 9, 2018
2 parents 6ad6e43 + 0b43327 commit 7370549
Show file tree
Hide file tree
Showing 965 changed files with 1,425 additions and 654,606 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ src/qt/test/moc*.cpp
*.pyc
*.o
*.o-*
*.patch
*.a
*.pb.cc
*.pb.h
Expand Down
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "tor"]
path = tor
url = https://github.com/torproject/tor.git
branch = maint-0.3.2
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ matrix:
include:

- os: linux
dist: trusty
dist: xenial
sudo: required
env: VERGE_PLATFORM='linux'
compiler: gcc
Expand Down
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ACLOCAL_AMFLAGS = -I src/m4
SUBDIRS = src
SUBDIRS = tor src
.PHONY: deploy FORCE

GZIP_ENV="-9n"
Expand Down
74 changes: 73 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,79 @@ You can also check out this [Linux Wallet Video Tutorial](https://www.youtube.co
## Developer Notes
Can be found [here](./doc/dev-notes.md)
```shell
sudo rm -Rf ~/VERGE #(if you already have it)
sudo apt-get -y install git && cd ~ && git clone https://github.com/vergecurrency/VERGE && cd VERGE && sh go.sh
```

The _slightly_ longer version:

1. Install the dependencies. **Note**: If you are on debian, you will also need to `apt-get install libcanberra-gtk-module`.

```shell
sudo add-apt-repository ppa:bitcoin/bitcoin
sudo apt-get update
sudo apt-get install \
libdb4.8-dev libdb4.8++-dev build-essential \
libtool autotools-dev automake pkg-config libssl-dev libevent-dev \
bsdmainutils git libboost-all-dev libminiupnpc-dev libqt5gui5 \
libqt5core5a libqt5dbus5 libevent-dev qttools5-dev \
qttools5-dev-tools libprotobuf-dev protobuf-compiler libqrencode-dev \
libseccomp-dev libcap-dev
```

2. Clone the git repository and compile the daemon and gui wallet:

```shell
git clone https://github.com/vergecurrency/verge && cd verge && ./autogen.sh && ./configure && make
```

> **Note**: If you get a "memory exhausted" error, make a swap file. (https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-16-04)


### Mac OS X Wallet

> **Note:** This has only been confirmed to work on OS X Sierra (10.12) and OS X High Sierra (10.13) with XCode 9.2 and `Apple LLVM version 9.0.0 (clang-900.0.39.2)`.

1. Ensure you have mysql and boost installed.

```shell
brew install mysql boost
```

2. Ensure you have python 2.7 installed and in your path (OS X comes with this by default)

```shell
python --version
```

3. Export the required environment variables

```shell
export VERGE_PLATFORM='mac'
export CXX=clang++
export CC=clang
```

4. Run your build commands

```shell
./building/common.sh
./building/mac/requirements.sh
./building/mac/build.sh
```

5. Grab a :coffee: and wait it out

6. Create the `.dmg` file

```shell
./building/mac/dist.sh
```

### Windows Wallet

TODO. Take a look as [building/windows](./building/windows).

## Docker Images

Expand Down
18 changes: 17 additions & 1 deletion autogen.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
#!/bin/sh
#!/bin/bash
set -e
pushd tor
git checkout -f
popd

git submodule update --init --recursive
srcdir="$(dirname $0)"
cd "$srcdir"
autoreconf --install --force

pushd tor
patch --no-backup-if-mismatch -f -p0 < ../tor-am.patch
patch --no-backup-if-mismatch -f -p0 < ../tor-or-am.patch
./autogen.sh
popd





2 changes: 1 addition & 1 deletion building/linux/requirements.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sudo apt-get update -qq > /dev/null

sudo apt-get --yes -qq install qtbase5-dev qtdeclarative5-dev libqt5webkit5-dev libsqlite3-dev zip > /dev/null
sudo apt-get --yes -qq install qt5-default qttools5-dev-tools libdb4.8-dev libdb4.8++-dev > /dev/null
sudo apt-get --yes -qq install build-essential libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils git libboost-system-dev libboost-filesystem-dev libqrencode-dev libboost-program-options-dev libboost-test-dev libboost-thread-dev libboost-all-dev libprotobuf-dev protobuf-compiler libminiupnpc-dev libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev > /dev/null
sudo apt-get --yes -qq install build-essential libseccomp-dev libcap-dev libtool autotools-dev automake pkg-config libssl-dev libevent-dev zlib1g-dev bsdmainutils git libboost-system-dev libboost-filesystem-dev libqrencode-dev libboost-program-options-dev libboost-test-dev libboost-thread-dev libboost-all-dev libprotobuf-dev protobuf-compiler libminiupnpc-dev libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev > /dev/null



2 changes: 1 addition & 1 deletion building/mac/requirements.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ brew uninstall qt5
brew install [email protected] pkg-config automake

# Install some deps
brew install [email protected] protobuf miniupnpc openssl qrencode berkeley-db4
brew install [email protected] protobuf miniupnpc openssl qrencode berkeley-db4 libseccomp libcap

# Make sure our stuff is linked in our path
brew link automake autoconf
8 changes: 8 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ AC_CANONICAL_HOST
AH_TOP([#ifndef VERGE_CONFIG_H])
AH_TOP([#define VERGE_CONFIG_H])
AH_BOTTOM([#endif //VERGE_CONFIG_H])
AX_SUBDIRS_CONFIGURE([tor], [[--disable-unittests], [--disable-system-torrc], [--disable-systemd], [--disable-lzma], [--disable-asciidoc], [--with-openssl-dir=$($PKG_CONFIG --variable=libdir openssl)], [CFLAGS=$($PKG_CONFIG --cflags openssl) -fPIC -O2]])


# This m4 will only be used if a system copy cannot be found. This is helpful
# on systems where autotools are installed but the pkg-config macros are not in
Expand Down Expand Up @@ -548,6 +550,12 @@ if test x$use_pkgconfig = xyes; then
m4_ifdef(
[PKG_CHECK_MODULES],
[
PKG_CHECK_MODULES(LIBEVENT, [libevent], [], [AC_MSG_ERROR([libevent not found])])
PKG_CHECK_MODULES(ZLIB, [zlib], [], [AC_MSG_ERROR([zlib not found])])
if test x$TARGET_OS = xlinux; then
PKG_CHECK_MODULES(LIBSECCOMP, [libseccomp], [], [AC_MSG_ERROR([libseccomp not found])])
PKG_CHECK_MODULES(LIBCAP, [libcap], [], [AC_MSG_ERROR([libcap not found])])
fi
PKG_CHECK_MODULES([SSL], [libssl], [INCLUDES="$INCLUDES $SSL_CFLAGS"; LIBS="$LIBS $SSL_LIBS"], [AC_MSG_ERROR(openssl not found.)])
PKG_CHECK_MODULES([CRYPTO], [libcrypto], [INCLUDES="$INCLUDES $CRYPTO_CFLAGS"; LIBS="$LIBS $CRYPTO_LIBS"], [AC_MSG_ERROR(libcrypto not found.)])
BITCOIN_QT_CHECK([PKG_CHECK_MODULES([PROTOBUF], [protobuf], [have_protobuf=yes], [BITCOIN_QT_FAIL(libprotobuf not found)])])
Expand Down
22 changes: 19 additions & 3 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ BITCOIN_INCLUDES=-I$(builddir) -I$(builddir)/obj $(BOOST_CPPFLAGS) $(LEVELDB_CPP
LIBBITCOIN_SERVER=libbitcoin_server.a
LIBBITCOIN_WALLET=libbitcoin_wallet.a
LIBBITCOIN_COMMON=libbitcoin_common.a

LIBBITCOIN_UTIL=libbitcoin_util.a
if HAVE_SSE2
LIBBITCOIN_SSE2=libbitcoin_sse2.a
Expand Down Expand Up @@ -229,7 +230,6 @@ libbitcoin_util_a_SOURCES += compat/glibcxx_compat.cpp
endif

nodist_libbitcoin_util_a_SOURCES = $(srcdir)/obj/build.h

# bitcoind binary #
VERGEd_LDADD = \
$(LIBBITCOIN_SERVER) \
Expand All @@ -249,8 +249,24 @@ VERGEd_LDADD += libbitcoin_wallet.a
endif
VERGEd_SOURCES = daemon.cpp

VERGEd_LDADD += $(BOOST_LIBS) $(BDB_LIBS)
VERGEd_CPPFLAGS = $(BITCOIN_INCLUDES)
VERGEd_LDADD += \
../tor/src/or/libtor.a \
../tor/src/common/libor.a \
../tor/src/common/libor-ctime.a \
../tor/src/common/libor-crypto.a \
../tor/src/common/libor-event.a \
../tor/src/trunnel/libor-trunnel.a \
../tor/src/common/libcurve25519_donna.a \
../tor/src/ext/ed25519/donna/libed25519_donna.a \
../tor/src/ext/ed25519/ref10/libed25519_ref10.a \
../tor/src/ext/keccak-tiny/libkeccak-tiny.a \
$(LIBEVENT_LIBS) \
$(LIBSECCOMP_LIBS) \
$(LIBCAP_LIBS) \
$(ZLIB_LIBS)

VERGEd_LDADD += $(BOOST_LIBS) $(BDB_LIBS) $(LIBEVENT_LDFLAGS) $(LIBSECCOMP_LDFLAGS) $(LIBCAP_LDFLAGS) $(ZLIB_LDFLAGS)
VERGEd_CPPFLAGS = $(BITCOIN_INCLUDES) $(LIBEVENT_CFLAGS) $(LIBSECCOMP_CFLAGS) $(LIBCAP_CFLAGS) $(ZLIB_CFLAGS)

CLEANFILES = leveldb/libleveldb.a leveldb/libmemenv.a *.gcda *.gcno

Expand Down
17 changes: 16 additions & 1 deletion src/Makefile.qt.include
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,22 @@ if ENABLE_WALLET
qt_VERGE_qt_LDADD += $(LIBBITCOIN_WALLET)
endif
qt_VERGE_qt_LDADD += $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_SSE2) $(LIBLEVELDB) $(LIBMEMENV) \
$(BOOST_LIBS) $(QT_LIBS) $(QT_DBUS_LIBS) $(QR_LIBS) $(PROTOBUF_LIBS) $(BDB_LIBS)
$(BOOST_LIBS) $(QT_LIBS) $(QT_DBUS_LIBS) $(QR_LIBS) $(PROTOBUF_LIBS) $(BDB_LIBS) \
../tor/src/or/libtor.a \
../tor/src/common/libor.a \
../tor/src/common/libor-ctime.a \
../tor/src/common/libor-crypto.a \
../tor/src/common/libor-event.a \
../tor/src/trunnel/libor-trunnel.a \
../tor/src/common/libcurve25519_donna.a \
../tor/src/ext/ed25519/donna/libed25519_donna.a \
../tor/src/ext/ed25519/ref10/libed25519_ref10.a \
../tor/src/ext/keccak-tiny/libkeccak-tiny.a \
$(ZLIB_LIBS) \
$(LIBEVENT_LIBS) \
$(LIBCAP_LIBS) \
$(LIBSECCOMP_LIBS)

if TARGET_LINUX
qt_VERGE_qt_LDADD += -lrt
endif
Expand Down
3 changes: 2 additions & 1 deletion src/bloom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ bool CBloomFilter::IsWithinSizeConstraints() const
return vData.size() <= MAX_BLOOM_FILTER_SIZE && nHashFuncs <= MAX_HASH_FUNCS;
}

bool CBloomFilter::IsRelevantAndUpdate(const CTransaction& tx, const uint256& hash)
bool CBloomFilter::IsRelevantAndUpdate(const CTransaction& tx)
{
bool fFound = false;
// Match if the filter contains the hash of tx
Expand All @@ -109,6 +109,7 @@ bool CBloomFilter::IsRelevantAndUpdate(const CTransaction& tx, const uint256& ha
return true;
if (isEmpty)
return false;
const uint256& hash = tx.GetHash();
if (contains(hash))
fFound = true;

Expand Down
2 changes: 1 addition & 1 deletion src/bloom.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class CBloomFilter
bool IsWithinSizeConstraints() const;

// Also adds any outputs which match the filter to the filter (to match their spending txes)
bool IsRelevantAndUpdate(const CTransaction& tx, const uint256& hash);
bool IsRelevantAndUpdate(const CTransaction& tx);

// Checks for empty and full filters to avoid wasting cpu
void UpdateEmptyFull();
Expand Down
Loading

0 comments on commit 7370549

Please sign in to comment.