Browse Source

Merge branch 'next'

pull/38/head v3.7.0
Duke Leto 3 years ago
parent
commit
a349e29502
  1. 2
      DEVELOPING.md
  2. 4
      configure.ac
  3. 8
      doc/man/hush-cli.1
  4. 8
      doc/man/hush-tx.1
  5. 10
      doc/man/hushd.1
  6. 20
      src/bitcoin-cli.cpp
  7. 43
      src/chainparams.cpp
  8. 5
      src/clientversion.h
  9. 5
      src/hush/tlsmanager.cpp
  10. 6
      src/hush/utiltls.cpp
  11. 61
      src/main.cpp
  12. 15
      src/pow.cpp

2
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

4
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)))

8
doc/man/hush-cli.1

@ -1,9 +1,9 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.6.
.TH HUSH-CLI "1" "February 2021" "hush-cli v3.6.3" "User Commands"
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.10.
.TH HUSH-CLI "1" "March 2021" "hush-cli v3.7.0" "User Commands"
.SH NAME
hush-cli \- manual page for hush-cli v3.6.3
hush-cli \- manual page for hush-cli v3.7.0
.SH DESCRIPTION
Hush RPC client version v3.6.3\-e1d5c5b73
Hush RPC client version v3.7.0\-af5f461d0
.PP
In order to ensure you are adequately protecting your privacy when using Hush,
please see <https://hush.is/security/>.

8
doc/man/hush-tx.1

@ -1,9 +1,9 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.6.
.TH HUSH-TX "1" "February 2021" "hush-tx v3.6.3" "User Commands"
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.10.
.TH HUSH-TX "1" "March 2021" "hush-tx v3.7.0" "User Commands"
.SH NAME
hush-tx \- manual page for hush-tx v3.6.3
hush-tx \- manual page for hush-tx v3.7.0
.SH DESCRIPTION
hush\-tx utility version v3.6.3\-e1d5c5b73
hush\-tx utility version v3.7.0\-af5f461d0
.SS "Usage:"
.TP
hush\-tx [options] <hex\-tx> [commands]

10
doc/man/hushd.1

@ -1,9 +1,9 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.6.
.TH HUSHD "1" "February 2021" "hushd v3.6.3" "User Commands"
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.10.
.TH HUSHD "1" "March 2021" "hushd v3.7.0" "User Commands"
.SH NAME
hushd \- manual page for hushd v3.6.3
hushd \- manual page for hushd v3.7.0
.SH DESCRIPTION
Hush Daemon version v3.6.3\-e1d5c5b73
Hush Daemon version v3.7.0\-af5f461d0
.PP
In order to ensure you are adequately protecting your privacy when using Hush,
please see <https://hush.is/security/>.
@ -75,7 +75,7 @@ limit applied)
.HP
\fB\-par=\fR<n>
.IP
Set the number of script verification threads (\fB\-16\fR to 16, 0 = auto, <0 =
Set the number of script verification threads (\fB\-8\fR to 16, 0 = auto, <0 =
leave that many cores free, default: 0)
.HP
\fB\-pid=\fR<file>

20
src/bitcoin-cli.cpp

@ -1,9 +1,8 @@
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2013 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
/******************************************************************************
* Copyright © 2014-2019 The SuperNET Developers. *
* *
@ -18,17 +17,14 @@
* Removal or modification of this copyright notice is prohibited. *
* *
******************************************************************************/
#include "chainparamsbase.h"
#include "clientversion.h"
#include "rpc/client.h"
#include "rpc/protocol.h"
#include "util.h"
#include "utilstrencodings.h"
#include <boost/filesystem/operations.hpp>
#include <stdio.h>
#include <event2/buffer.h>
#include <event2/keyvalq_struct.h>
#include "support/events.h"
@ -63,15 +59,8 @@ std::string HelpMessageCli()
return strUsage;
}
//////////////////////////////////////////////////////////////////////////////
//
// Start
//
//
// Exception thrown on connection error. This error is used to determine
// when to wait if -rpcwait is given.
//
class CConnectionFailed : public std::runtime_error
{
public:
@ -82,19 +71,15 @@ public:
};
//
// This function returns either one of EXIT_ codes when it's expected to stop the process or
// CONTINUE_EXECUTION when it's expected to continue further.
//
static int AppInitRPC(int argc, char* argv[])
{
static_assert(CONTINUE_EXECUTION != EXIT_FAILURE,
"CONTINUE_EXECUTION should be different from EXIT_FAILURE");
static_assert(CONTINUE_EXECUTION != EXIT_SUCCESS,
"CONTINUE_EXECUTION should be different from EXIT_SUCCESS");
//
// Parameters
//
ParseParameters(argc, argv);
std:string name;
name = GetArg("-ac_name","");
@ -144,7 +129,6 @@ static int AppInitRPC(int argc, char* argv[])
return CONTINUE_EXECUTION;
}
/** Reply structure for request_done to fill in */
struct HTTPReply
{
@ -277,7 +261,7 @@ UniValue CallRPC(const std::string& strMethod, const UniValue& params)
// Parse reply
UniValue valReply(UniValue::VSTR);
if (!valReply.read(response.body))
throw std::runtime_error("couldn't parse reply from server");
throw std::runtime_error(strprintf("couldn't parse reply from server: %s",response.body));
const UniValue& reply = valReply.get_obj();
if (reply.empty())
throw std::runtime_error("expected reply to have result, error and id properties");

43
src/chainparams.cpp

@ -728,10 +728,45 @@ void *chainparams_commandline() {
(437000, uint256S("0x00000003ce6d4b0ea02f483633abae9da2b71e62e14e08f20af13452ab6814a7"))
(438000, uint256S("0x0000000d845b717aec3b273f9cb2d894d3caa05f91b3ad41b6581adfd90b267c"))
(439000, uint256S("0x000000099a44794ccf54bcba10780b163b6a369292263df1d8d62d2d58cc7cea"))
(440000, uint256S("0x0000000b741bda60e14a5d668581f60bfb852b09249428ca7c3a59b01db31af0")),
(int64_t) 1614333866, // time of last checkpointed block
(int64_t) 759609, // total txs
(double) 1606 // txs in the last day before block 440133
(440000, uint256S("0x0000000b741bda60e14a5d668581f60bfb852b09249428ca7c3a59b01db31af0"))
(441000, uint256S("0x000000150189ff4e6b3292d9feaebc1ed741a6c0534f1050cc152ad65d30906a"))
(442000, uint256S("0x0000000fd26b6822fbda02990619e1729b7f8e7cf1c39178b6040893b92a2cc9"))
(443000, uint256S("0x0000000ce6172397f985d9e3bec3d06c87d5606969a602eff9bae3a6a0e0eeae"))
(444000, uint256S("0x00000011997fb375389ecaecca589e722f9e6fbc147570cb39e88db51811d2fb"))
(445000, uint256S("0x0000000643bf6fd35088aecbebca66d313c4e153176b5da42102197164fef65c"))
(446000, uint256S("0x0000000441b5fb7d9c59fc75fb77cbf9b455dc5b4562bae0ce356500d7f422fd"))
(447000, uint256S("0x0000001978b57b5c4e49a03687a9e002a782548263918b6636cdcc36cdb11627"))
(448000, uint256S("0x0000001f1aa382c9ff75b41da17185a61db07569a4d1afa5040b836dbf7e38b0"))
(449000, uint256S("0x0000001bd53db30e282b94504a8fdb36ede55e3d3ce71336ef844df45b25d51a"))
(450000, uint256S("0x0000001648e3028682b133bc209c2538c6c776bd7d3d4b275dffef75db7bb9f4"))
(451000, uint256S("0x0000001c60e7abdebf883831bd899c5dbd8cac1ea68bb0957701e5595c8011b5"))
(452000, uint256S("0x0000000add6e6c36ec20a4e3091195c052a8f9d6498e1e85dbb10c45b70c08d3"))
(453000, uint256S("0x0000000a2bb73fff81add4d521655fe4566b6c656a9790cd2846f6f1ac7061d1"))
(454000, uint256S("0x000000059a0f7d5f1a381c20d485a1ce2bb41cfc8bc5abcbbf736a236732c3e8"))
(455000, uint256S("0x00000008542e9c1e83fdf4f71ad758ae0d372f95d486d93aaa1c448c529f1e6b"))
(456000, uint256S("0x000000093c40dcbb7152bc2561fdee97d0ddd202348db723755e8e47e10a1cf1"))
(457000, uint256S("0x000000176c7bd888c00198072ff533dd5daa7f0dd1991ee478c97ce2576a544f"))
(458000, uint256S("0x00000012f38a317148fa969062776ad7b30362b1901565f07af3045a324df8c5"))
(459000, uint256S("0x00000008f68f2b3b355f3d6c94d3eb2979e000a3817ae8089b4994d0a04ae13e"))
(460000, uint256S("0x0000001220f5bd3de5167b332268f52d056c5943b9334513d4ee138b97782759"))
(461000, uint256S("0x000000017d7c3a8b03f0b761ad56c1f6678d2642fb1d6a1a286e95fb47a43235"))
(462000, uint256S("0x00000001adb35a7234f02de06199ecd27f857b1304655ff9c37bd2c80c7e82c5"))
(463000, uint256S("0x00000015ee085765078c7c32770f4f6d8c38e25b1f16d3e4f3cea6da27a9e026"))
(464000, uint256S("0x000000165b10b74fa665df705954d8eae919bf6e8912fc8a9a4adb90179a4858"))
(465000, uint256S("0x000000051bd8d780ce69151738f6d4a81ea8b93305dd873396bff24835e9e6fb"))
(466000, uint256S("0x00000006cea7acd52ca5e0bbe0b759b5e26ee1d1f65eddd6b545020c4bd5f4a0"))
(467000, uint256S("0x00000018df5117519d46a4b825c2603927fd62a13d180474135a97af6b5a02dd"))
(468000, uint256S("0x0000000acb30c045fa367e947e1785b9bd65c06d5b67494529450f1ebff3f303"))
(469000, uint256S("0x000000097152a491ad065423de4324ada41f3612de5b80ffb585e28d2a11d2c6"))
(470000, uint256S("0x000000043ed32a85a784f1adf8328f80350b3960698c73345951d99ab369275f"))
(471000, uint256S("0x0000000dabe6173ccc2e8be79774c0aed930c8f24a311e466e543b3bbf36be3f"))
(472000, uint256S("0x0000001f727ffbe5b1ad17206c060aa77e9b20257f1764f1ac018a0f64f19bd1"))
(473000, uint256S("0x0000000b7ee1e1d0f6b577c02a924733d2c4d6d5805daa51e44e543eadacba8b"))
(474000, uint256S("0x0000001260b7935e520244a3591cb6b37de3b36c45dae5318f0bb7eda6847e17"))
(475000, uint256S("0x0000000db956f0dcecc58ccfc8463f49910d455fc3c223ab36a93c5c468513cc")),
(int64_t) 1617173192, // time of last checkpointed block
(int64_t) 809511, // total txs
(double) 3228 // txs in the last day before block 475640
};
} else {
checkpointData = //(Checkpoints::CCheckpointData)

5
src/clientversion.h

@ -3,6 +3,7 @@
// 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 developers, who cared about privacy?
/******************************************************************************
* Copyright © 2014-2019 The SuperNET Developers. *
* *
@ -28,8 +29,8 @@
//! These need to be macros, as clientversion.cpp's and bitcoin*-res.rc's voodoo requires it
// Must be kept in sync with configure.ac , ugh!
#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
//! Set to true for release, false for prerelease or test build

5
src/hush/tlsmanager.cpp

@ -425,8 +425,11 @@ bool TLSManager::CheckKeyCert()
return false;
}
if (wolfSSL_X509_verify(mycert, mykey) == WOLFSSL_SUCCESS) {
int err = wolfSSL_X509_verify(mycert, mykey);
if (err == WOLFSSL_SUCCESS) {
return true;
} else {
LogPrintf("%s: x509 verification error: %d = %s\n", __func__, err);
}
LogPrintf("Generated key and certificate do not match!!!\n");

6
src/hush/utiltls.cpp

@ -43,6 +43,7 @@ WOLFSSL_EVP_PKEY* GenerateEcKey(int nid)
WOLFSSL_X509* GenerateCertificate(WOLFSSL_EVP_PKEY *keypair)
{
if (!keypair) {
LogPrintf("%s: Null keypair!\n", __func__);
return NULL;
}
@ -60,12 +61,17 @@ WOLFSSL_X509* GenerateCertificate(WOLFSSL_EVP_PKEY *keypair)
// private key from keypair is used; signature will be set inside of the cert
bCertSigned = wolfSSL_X509_sign(cert, keypair, wolfSSL_EVP_sha512());
}
} else {
LogPrintf("%s: Unable to alloc rand bytes!\n", __func__);
}
if (!bCertSigned) {
LogPrintf("%s: TLS cert not signed correctly!\n", __func__);
wolfSSL_X509_free(cert);
cert = NULL;
}
} else {
LogPrintf("%s: Unable to create x509 cert!\n", __func__);
}
return cert;

61
src/main.cpp

@ -3160,7 +3160,8 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
int32_t futureblock;
CAmount blockReward = GetBlockSubsidy(pindex->GetHeight(), chainparams.GetConsensus());
uint64_t notarypaycheque = 0;
// Check it again to verify JoinSplit proofs, and in case a previous version let a bad block in
// Check it again to verify ztx proofs, and in case a previous version let a bad block in
if ( !CheckBlock(&futureblock,pindex->GetHeight(),pindex,block, state, fExpensiveChecks ? verifier : disabledVerifier, fCheckPOW, !fJustCheck) || futureblock != 0 )
{
//fprintf(stderr,"checkblock failure in connectblock futureblock.%d\n",futureblock);
@ -5033,23 +5034,32 @@ bool ContextualCheckBlockHeader(const CBlockHeader& block, CValidationState& sta
assert(pindexPrev);
int nHeight = pindexPrev->GetHeight()+1;
bool ishush3 = strncmp(SMART_CHAIN_SYMBOL, "HUSH3",5) == 0 ? true : false;
int daaForkHeight = GetArg("-daaforkheight", 450000);
int nHeight = pindexPrev->GetHeight()+1;
bool ishush3 = strncmp(SMART_CHAIN_SYMBOL, "HUSH3",5) == 0 ? true : false;
// Check Proof-of-Work difficulty
if (ishush3) {
// The change of blocktime from 150s to 75s caused Weird Stuff in the difficulty/work calculations
// Difficulty (nBits) relies on the current blocktime of this block
if ((ASSETCHAINS_BLOCKTIME != 75) && (nHeight >= nFirstHalvingHeight)) {
LogPrintf("%s: Blocktime halving to 75s at height %d!\n",__func__,nHeight);
ASSETCHAINS_BLOCKTIME = 75;
hush_changeblocktime();
}
// The change of blocktime from 150s to 75s caused incorrect AWT of 34 blocks instead of 17
// caused by the fact that Difficulty Adjustment Algorithms do not take into account blocktime
// changing at run-time, which breaks assumptions in the algorithm
// changing at run-time, from Consensus::Params being a const struct
unsigned int nNextWork = GetNextWorkRequired(pindexPrev, &block, consensusParams);
//if ((nHeight < 340000 || nHeight > 342500) && block.nBits != nNextWork) {
LogPrintf("%s: nbits ,%d,%lu,%lu,%d\n",__func__, nHeight, nNextWork, block.nBits, nNextWork - block.nBits );
if (block.nBits != nNextWork) {
//cout << "Incorrect HUSH diffbits at height " << nHeight <<
// " " << block.nBits << " block.nBits vs. calc " << nNextWork <<
// " " << block.GetHash().ToString() << " @ " << block.GetBlockTime() << endl;
if (nHeight < 340000) {
return state.DoS(100, error("%s: Incorrect diffbits at height %d", __func__, nHeight), REJECT_INVALID, "bad-diffbits");
// Enforce correct nbits at DAA fork height, before that, ignore
if (nHeight > daaForkHeight) {
//cout << "Incorrect HUSH diffbits at height " << nHeight <<
// " " << block.nBits << " block.nBits vs. calc " << nNextWork <<
// " " << block.GetHash().ToString() << " @ " << block.GetBlockTime() << endl;
return state.DoS(100, error("%s: Incorrect diffbits at height %d: %lu vs %lu ", __func__, nHeight, nNextWork, block.nBits), REJECT_INVALID, "bad-diffbits");
} else {
LogPrintf("%s: Ignoring nbits calc : %lu vs block %lu\n",__func__, nNextWork, block.nBits );
cout << "Ignoring nbits for height=" << nHeight << endl;
}
}
@ -5371,33 +5381,6 @@ static bool IsSuperMajority(int minVersion, const CBlockIndex* pstart, unsigned
void hush_currentheight_set(int32_t height);
CBlockIndex *komodo_ensure(CBlock *pblock, uint256 hash)
{
CBlockIndex *pindex = 0;
BlockMap::iterator miSelf = mapBlockIndex.find(hash);
if ( miSelf != mapBlockIndex.end() )
{
if ( (pindex = miSelf->second) == 0 ) // create pindex so first Accept block doesnt fail
{
miSelf->second = AddToBlockIndex(*pblock);
//fprintf(stderr,"Block header %s is already known, but without pindex -> ensured %p\n",hash.ToString().c_str(),miSelf->second);
}
/*if ( hash != Params().GetConsensus().hashGenesisBlock )
{
miSelf = mapBlockIndex.find(pblock->hashPrevBlock);
if ( miSelf != mapBlockIndex.end() )
{
if ( miSelf->second == 0 )
{
miSelf->second = InsertBlockIndex(pblock->hashPrevBlock);
fprintf(stderr,"autocreate previndex %s\n",pblock->hashPrevBlock.ToString().c_str());
}
}
}*/
}
return(pindex);
}
bool ProcessNewBlock(bool from_miner,int32_t height,CValidationState &state, CNode* pfrom, CBlock* pblock, bool fForceProcessing, CDiskBlockPos *dbp)
{
// Preliminary checks

15
src/pow.cpp

@ -508,13 +508,10 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead
// Changing this requires changing many other things and
// changes consensus. Have fun -- Duke
int64_t AveragingWindowTimespan(int32_t height) {
int64_t AWT = 2550;
/*
int32_t forkHeight = 0;
if (height >= forkHeight) {
AWT = 1275;
}
*/
// used in const methods, beware!
// This is the correct AWT for 75s blocktime, before block 340k
// the correct value was 2550 when the blocktime was 150s
int64_t AWT = 1275;
return AWT;
}
@ -560,11 +557,11 @@ unsigned int CalculateNextWorkRequired(arith_uint256 bnAvg,
LogPrint("pow", "AveragingWindowTimespan = %d nActualTimespan = %d\n", AWT, nActualTimespan);
LogPrint("pow", "Current average: %08x %s\n", bnAvg.GetCompact(), bnAvg.ToString());
LogPrint("pow", "After: %08x %s\n", bnNew.GetCompact(), bnNew.ToString());
//if(fDebug) {
if(fDebug) {
fprintf(stderr, "%s: nbits Current average: %08x %s\n", __func__, bnAvg.GetCompact(), bnAvg.ToString().c_str());
fprintf(stderr, "%s: bits After: %08x %s\n", __func__, bnNew.GetCompact(), bnNew.ToString().c_str());
fprintf(stderr,"%s: AWT=%lu ActualTimeSpan=%li MinActual=%li MaxActual=%li\n",__func__, AWT, nActualTimespan, params.MinActualTimespan(), params.MaxActualTimespan());
//}
}
return bnNew.GetCompact();
}

Loading…
Cancel
Save