diff --git a/DEVELOPING.md b/DEVELOPING.md
index 0a10da9f6..0aae790f5 100644
--- a/DEVELOPING.md
+++ b/DEVELOPING.md
@@ -19,7 +19,7 @@ Divide how many GBs of RAM you have by 2, subtract one. Use that many jobs.
## Dealing with dependency changes
-Let's say you change a dependency and want the compile the notice. If your
+Let's say you change a dependency and want the compile to notice. If your
change is outside of the main Hush source code, in ./src, simply running
`make` will not notice, and sometimes not even `build.sh`. You can always
do a fresh clone or `make clean`, but that will take a lot of time. Those
diff --git a/configure.ac b/configure.ac
index 216f612bf..16766d197 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,8 +1,8 @@
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, 3)
+define(_CLIENT_VERSION_MINOR, 7)
+define(_CLIENT_VERSION_REVISION, 0)
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 07e7af868..6d03d656d 100755
--- a/contrib/devtools/gen-linux-binary-release.sh
+++ b/contrib/devtools/gen-linux-binary-release.sh
@@ -5,8 +5,10 @@
set -e
set -x
-#TODO: autodect version number, error handling
-FILE="hush-3.6.2-linux-amd64.tar"
+#hardcode and uncomment if hushd is not running on this machine
+#VERSION=3.6.3
+VERSION=$(./src/hushd --version|grep version|cut -d' ' -f4|cut -d- -f1|sed 's/v//g')
+FILE="hush-$VERSION-linux-amd64.tar"
TIME=$(perl -e 'print time')
mv build build.$TIME
diff --git a/contrib/devtools/gen-manpages.sh b/contrib/devtools/gen-manpages.sh
index 4acce0959..f4f569710 100755
--- a/contrib/devtools/gen-manpages.sh
+++ b/contrib/devtools/gen-manpages.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-# Copyright (c) 2016-2020 The Hush developers
+# Copyright (c) 2016-2021 The Hush developers
# Released under the GPLv3
TOPDIR=${TOPDIR:-$(git rev-parse --show-toplevel)}
@@ -12,6 +12,15 @@ HUSHTX=${HUSHTX:-$SRCDIR/hush-tx}
[ ! -x $HUSHD ] && echo "$HUSHD not found or not executable." && exit 1
+# Check if help2man is installed
+# If not then display error to user and exit
+if ! command -v help2man &> /dev/null
+then
+ echo "help2man could not be found"
+ echo "Please install from your Linux package manager and try again"
+ exit
+fi
+
# use this if hushd is not running
#HUSHVER="v3.6.2"
HUSHVER=$(./src/hushd --version|head -n1|cut -d' ' -f4|cut -d- -f1)
diff --git a/doc/man/hush-cli.1 b/doc/man/hush-cli.1
index 857dbde06..7c381a192 100644
--- a/doc/man/hush-cli.1
+++ b/doc/man/hush-cli.1
@@ -1,9 +1,9 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.10.
-.TH HUSH-CLI "1" "February 2021" "hush-cli v3.6.2" "User Commands"
+.TH HUSH-CLI "1" "March 2021" "hush-cli v3.7.0" "User Commands"
.SH NAME
-hush-cli \- manual page for hush-cli v3.6.2
+hush-cli \- manual page for hush-cli v3.7.0
.SH DESCRIPTION
-Hush RPC client version v3.6.2\-e2e6e44ca\-dirty
+Hush RPC client version v3.7.0\-af5f461d0
.PP
In order to ensure you are adequately protecting your privacy when using Hush,
please see .
diff --git a/doc/man/hush-tx.1 b/doc/man/hush-tx.1
index 6d4ac2f11..daba9cb8e 100644
--- a/doc/man/hush-tx.1
+++ b/doc/man/hush-tx.1
@@ -1,9 +1,9 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.10.
-.TH HUSH-TX "1" "February 2021" "hush-tx v3.6.2" "User Commands"
+.TH HUSH-TX "1" "March 2021" "hush-tx v3.7.0" "User Commands"
.SH NAME
-hush-tx \- manual page for hush-tx v3.6.2
+hush-tx \- manual page for hush-tx v3.7.0
.SH DESCRIPTION
-hush\-tx utility version v3.6.2\-e2e6e44ca\-dirty
+hush\-tx utility version v3.7.0\-af5f461d0
.SS "Usage:"
.TP
hush\-tx [options] [commands]
diff --git a/doc/man/hushd.1 b/doc/man/hushd.1
index 54780a095..5b443aab1 100644
--- a/doc/man/hushd.1
+++ b/doc/man/hushd.1
@@ -1,9 +1,9 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.10.
-.TH HUSHD "1" "February 2021" "hushd v3.6.2" "User Commands"
+.TH HUSHD "1" "March 2021" "hushd v3.7.0" "User Commands"
.SH NAME
-hushd \- manual page for hushd v3.6.2
+hushd \- manual page for hushd v3.7.0
.SH DESCRIPTION
-Hush Daemon version v3.6.2\-e2e6e44ca\-dirty
+Hush Daemon version v3.7.0\-af5f461d0
.PP
In order to ensure you are adequately protecting your privacy when using Hush,
please see .
diff --git a/doc/tor.md b/doc/tor.md
index 146768bec..c00db2fbd 100644
--- a/doc/tor.md
+++ b/doc/tor.md
@@ -1,6 +1,8 @@
-*** Warning: Do not assume Tor support does the correct thing in Hush; better Tor support is a future feature goal. ***
+# Warning
-# TOR SUPPORT IN HUSH
+ Do not assume Tor support works perfectly in Hush; better Tor support is currently being worked on.
+
+# Hush + Tor
It is possible to run Hush as a Tor hidden service, and connect to such services.
@@ -34,6 +36,11 @@ In a typical situation, this suffices to run behind a Tor proxy:
./hushd -proxy=127.0.0.1:9050
+If using the Tor Browser Bundle:
+
+ ./hushd -proxy=127.0.0.1:9150
+
+
2. Run a Hush hidden server
----------------------------
@@ -43,11 +50,10 @@ reachable from the Tor network. Add these lines to your /etc/tor/torrc (or equiv
config file):
HiddenServiceDir /var/lib/tor/hush-service/
- HiddenServicePort 7771 127.0.0.1:7771
- HiddenServicePort 17771 127.0.0.1:17771
+ HiddenServicePort 18030 127.0.0.1:18030
The directory can be different of course, but (both) port numbers should be equal to
-your hushd's P2P listen port (7771 by default).
+your hushd's P2P listen port (18030 by default).
-externalip=X You can tell Hush about its publicly reachable address using
this option, and this can be a .onion address. Given the above
@@ -69,10 +75,10 @@ your hushd's P2P listen port (7771 by default).
In a typical situation, where you're only reachable via Tor, this should suffice:
- ./hushd -proxy=127.0.0.1:9050 -externalip=zctestseie6wxgio.onion -listen
+ ./hushd -proxy=127.0.0.1:9050 -externalip=hushc0de123.onion -listen
-(obviously, replace the Onion address with your own). It should be noted that you still
-listen on all devices and another node could establish a clearnet connection, when knowing
+(obviously, replace the Onion address with your own). Currently only v2 HS's are supported.
+It should be noted that you still listen on all devices and another node could establish a clearnet connection, when knowing
your address. To mitigate this, additionally bind the address of your Tor proxy:
./hushd ... -bind=127.0.0.1
@@ -82,12 +88,12 @@ as well, use `discover` instead:
./hushd ... -discover
-and open port 7771 on your firewall (or use -upnp).
+and open port 18030 on your firewall.
If you only want to use Tor to reach onion addresses, but not use it as a proxy
for normal IPv4/IPv6 communication, use:
- ./hushd -onion=127.0.0.1:9050 -externalip=zctestseie6wxgio.onion -discover
+ ./hushd -onion=127.0.0.1:9050 -externalip=hushc0de123.onion -discover
3. Automatically listen on Tor
@@ -135,9 +141,9 @@ Now use hush-cli to verify there is only a single peer connection.
[
{
"id" : 1,
- "addr" : "zctestseie6wxgio.onion:17770",
+ "addr" : "zcashhoneypot.onion:18030",
...
- "version" : 170010,
+ "version" : 1987420,
"subver" : "/GoldenSandtrout:3.6.0/",
...
}
@@ -145,4 +151,4 @@ Now use hush-cli to verify there is only a single peer connection.
To connect to multiple Tor nodes, use:
- ./hushd -onion=127.0.0.1:9050 -addnode=fuckzookoeie6wxgio.onion -dnsseed=0 -onlynet=onion
+ ./hushd -onion=127.0.0.1:9050 -addnode=hushbeef123.onion -dnsseed=0 -onlynet=onion
diff --git a/src/addrman.cpp b/src/addrman.cpp
index 1568deb9f..7016c1882 100644
--- a/src/addrman.cpp
+++ b/src/addrman.cpp
@@ -215,8 +215,7 @@ void CAddrMan::MakeTried(CAddrInfo& info, int nId)
info.fInTried = true;
}
-void CAddrMan::Good_(const CService& addr, int64_t nTime)
-{
+void CAddrMan::Good_(const CService& addr, bool test_before_evict, int64_t nTime) {
int nId;
CAddrInfo* pinfo = Find(addr, &nId);
@@ -258,12 +257,101 @@ void CAddrMan::Good_(const CService& addr, int64_t nTime)
if (nUBucket == -1)
return;
- LogPrint("addrman", "Moving %s to tried\n", addr.ToString());
+ // which tried bucket to move the entry to
+ int tried_bucket = info.GetTriedBucket(nKey,m_asmap);
+ int tried_bucket_pos = info.GetBucketPosition(nKey, false, tried_bucket);
+
+ // Will moving this address into tried evict another entry?
+ if (test_before_evict && (vvTried[tried_bucket][tried_bucket_pos] != -1)) {
+ LogPrint("addrman", "Collision inserting element into tried table, moving %s to m_tried_collisions=%d\n", addr.ToString(), m_tried_collisions.size());
+ if (m_tried_collisions.size() < ADDRMAN_SET_TRIED_COLLISION_SIZE) {
+ m_tried_collisions.insert(nId);
+ }
+ } else {
+ LogPrint("addrman", "Moving %s to tried\n", addr.ToString());
+ printf("%s: Moving %s to tried\n", __func__, addr.ToString().c_str() );
- // move nId to the tried tables
- MakeTried(info, nId);
+ // move nId to the tried tables
+ MakeTried(info, nId);
+ }
}
+void CAddrMan::ResolveCollisions_() {
+ for (std::set::iterator it = m_tried_collisions.begin(); it != m_tried_collisions.end();) {
+ int id_new = *it;
+ bool erase_collision = false;
+
+ // If id_new not found in mapInfo remove it from m_tried_collisions
+ if (mapInfo.count(id_new) != 1) {
+ erase_collision = true;
+ } else {
+ CAddrInfo& info_new = mapInfo[id_new];
+
+ // Which tried bucket to move the entry to.
+ int tried_bucket = info_new.GetTriedBucket(nKey,m_asmap);
+ int tried_bucket_pos = info_new.GetBucketPosition(nKey, false, tried_bucket);
+ if (!info_new.IsValid()) { // id_new may no longer map to a valid address
+ erase_collision = true;
+ } else if (vvTried[tried_bucket][tried_bucket_pos] != -1) { // The position in the tried bucket is not empty
+
+ // Get the to-be-evicted address that is being tested
+ int id_old = vvTried[tried_bucket][tried_bucket_pos];
+ CAddrInfo& info_old = mapInfo[id_old];
+
+ // Has successfully connected in last X hours
+ if (GetTime() - info_old.nLastSuccess < ADDRMAN_REPLACEMENT_HOURS*(60*60)) {
+ erase_collision = true;
+ } else if (GetTime() - info_old.nLastTry < ADDRMAN_REPLACEMENT_HOURS*(60*60)) { // attempted to connect and failed in last X hours
+
+ // Give address at least 60 seconds to successfully connect
+ if (GetTime() - info_old.nLastTry > 60) {
+ LogPrint("addrman", "Swapping %s for %s in tried table\n", info_new.ToString(), info_old.ToString());
+
+ // Replaces an existing address already in the tried table with the new address
+ Good_(info_new, false, GetTime());
+ erase_collision = true;
+ }
+ }
+ } else { // Collision is not actually a collision anymore
+ Good_(info_new, false, GetTime());
+ erase_collision = true;
+ }
+ }
+
+ if (erase_collision) {
+ m_tried_collisions.erase(it++);
+ } else {
+ it++;
+ }
+ }
+}
+
+CAddrInfo CAddrMan::SelectTriedCollision_() {
+ if (m_tried_collisions.size() == 0) return CAddrInfo();
+
+ std::set::iterator it = m_tried_collisions.begin();
+
+ // Selects a random element from m_tried_collisions
+ std::advance(it, GetRandInt(m_tried_collisions.size()));
+ int id_new = *it;
+
+ // If id_new not found in mapInfo remove it from m_tried_collisions
+ if (mapInfo.count(id_new) != 1) {
+ m_tried_collisions.erase(it);
+ return CAddrInfo();
+ }
+
+ CAddrInfo& newInfo = mapInfo[id_new];
+
+ // which tried bucket to move the entry to
+ int tried_bucket = newInfo.GetTriedBucket(nKey,m_asmap);
+ int tried_bucket_pos = newInfo.GetBucketPosition(nKey, false, tried_bucket);
+ int id_old = vvTried[tried_bucket][tried_bucket_pos];
+
+ return mapInfo[id_old];
+}
+
+
bool CAddrMan::Add_(const CAddress& addr, const CNetAddr& source, int64_t nTimePenalty)
{
if (!addr.IsRoutable())
diff --git a/src/addrman.h b/src/addrman.h
index eb2662536..68419ea61 100644
--- a/src/addrman.h
+++ b/src/addrman.h
@@ -1,8 +1,7 @@
// Copyright (c) 2012 Pieter Wuille
-// 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
-
/******************************************************************************
* Copyright © 2014-2019 The SuperNET Developers. *
* *
@@ -31,7 +30,6 @@
#include "clientversion.h"
#include "hash.h"
#include "netbase.h"
-
#include