Tweak test suite and rename to HUSH_INSYNC
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
# Copyright 2019-2020 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
|
||||
|
||||
DIST_SUBDIRS = secp256k1 univalue cryptoconditions
|
||||
|
||||
@@ -251,7 +253,7 @@ obj/build.h: FORCE
|
||||
$(abs_top_srcdir)
|
||||
libbitcoin_util_a-clientversion.$(OBJEXT): obj/build.h
|
||||
|
||||
# server: zcashd
|
||||
# server: hushd
|
||||
libbitcoin_server_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(EVENT_CFLAGS) $(EVENT_PTHREADS_CFLAGS)
|
||||
libbitcoin_server_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
|
||||
libbitcoin_server_a_SOURCES = \
|
||||
@@ -398,7 +400,7 @@ crypto_libbitcoin_crypto_a_SOURCES += \
|
||||
${EQUIHASH_TROMP_SOURCES}
|
||||
endif
|
||||
|
||||
# common: shared between zcashd and non-server tools
|
||||
# common: shared between hushd and non-server tools
|
||||
libbitcoin_common_a_CPPFLAGS = -fPIC $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
|
||||
libbitcoin_common_a_CXXFLAGS = -fPIC $(AM_CXXFLAGS) $(PIE_FLAGS)
|
||||
libbitcoin_common_a_SOURCES = \
|
||||
@@ -607,7 +609,7 @@ komodo_tx_LDADD = \
|
||||
|
||||
komodo_tx_LDADD += $(BOOST_LIBS) $(CRYPTO_LIBS)
|
||||
|
||||
# zcash protocol primitives #
|
||||
# Zcash Protocol Primitives
|
||||
libzcash_a_SOURCES = \
|
||||
zcash/IncrementalMerkleTree.cpp \
|
||||
zcash/NoteEncryption.cpp \
|
||||
@@ -712,7 +714,7 @@ endif
|
||||
$(AM_V_GEN) $(PROTOC) --cpp_out=$(@D) --proto_path=$(abspath $(<D) $<)
|
||||
|
||||
if ENABLE_TESTS
|
||||
include Makefile.ktest.include
|
||||
include Makefile.test-hush.include
|
||||
#include Makefile.test.include
|
||||
#include Makefile.gtest.include
|
||||
endif
|
||||
|
||||
@@ -6,16 +6,16 @@ TESTS += hush-test
|
||||
bin_PROGRAMS += hush-test
|
||||
|
||||
# tool for generating our public parameters
|
||||
hush_test_SOURCES = \
|
||||
test-hush/main.cpp \
|
||||
test-hush/testutils.cpp \
|
||||
test-hush/test_cryptoconditions.cpp \
|
||||
test-hush/test_coinimport.cpp \
|
||||
test-hush/test_eval_bet.cpp \
|
||||
test-hush/test_eval_notarisation.cpp \
|
||||
test-hush/test_parse_notarisation.cpp \
|
||||
test-hush/test_addrman.cpp \
|
||||
test-hush/test_netbase_tests.cpp
|
||||
hush_test_SOURCES = test-hush/main.cpp
|
||||
# devs can enable this shit, it just slows down default compiles
|
||||
# test-hush/testutils.cpp \
|
||||
# test-hush/test_cryptoconditions.cpp \
|
||||
# test-hush/test_coinimport.cpp \
|
||||
# test-hush/test_eval_bet.cpp \
|
||||
# test-hush/test_eval_notarisation.cpp \
|
||||
# test-hush/test_parse_notarisation.cpp \
|
||||
# test-hush/test_addrman.cpp \
|
||||
# test-hush/test_netbase_tests.cpp
|
||||
|
||||
hush_test_CPPFLAGS = $(hushd_CPPFLAGS)
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ What is needed is for the dealer node to track the entropy tx that was already b
|
||||
|
||||
#define MAX_ENTROPYUSED 8192
|
||||
#define DICE_MINUTXOS 15000
|
||||
extern int32_t KOMODO_INSYNC;
|
||||
extern int32_t HUSH_INSYNC;
|
||||
|
||||
pthread_mutex_t DICE_MUTEX,DICEREVEALED_MUTEX;
|
||||
|
||||
@@ -329,7 +329,7 @@ void *dicefinish(void *_ptr)
|
||||
dicepk = GetUnspendable(cp,0);
|
||||
GetCCaddress(cp,CCaddr,GetUnspendable(cp,0));
|
||||
fprintf(stderr,"start dicefinish thread %s CCaddr.%s\n",coinaddr,CCaddr);
|
||||
if ( (newht= KOMODO_INSYNC) == 0 )
|
||||
if ( (newht= HUSH_INSYNC) == 0 )
|
||||
sleep(7);
|
||||
sleep(3);
|
||||
while ( 1 )
|
||||
@@ -489,7 +489,7 @@ void *dicefinish(void *_ptr)
|
||||
free(utxos);
|
||||
}
|
||||
}
|
||||
if ( (newht= KOMODO_INSYNC) == 0 || newht == lastheight )
|
||||
if ( (newht= HUSH_INSYNC) == 0 || newht == lastheight )
|
||||
sleep(3);
|
||||
else usleep(500000);
|
||||
}
|
||||
@@ -936,7 +936,7 @@ bool DiceValidate(struct CCcontract_info *cp,Eval *eval,const CTransaction &tx,
|
||||
if ( (iswin= DiceIsWinner(entropy,entropyvout,txid,tx,vinTx,hash,sbits,minbet,maxbet,maxodds,timeoutblocks,fundingtxid)) != 0 )
|
||||
{
|
||||
// will only happen for fundingPubKey
|
||||
if ( KOMODO_INSYNC != 0 && KOMODO_DEALERNODE != 0 )
|
||||
if ( HUSH_INSYNC != 0 && KOMODO_DEALERNODE != 0 )
|
||||
DiceQueue(iswin,sbits,fundingtxid,txid,tx,entropyvout);
|
||||
}
|
||||
else
|
||||
@@ -1669,7 +1669,7 @@ void *dealer0_loop(void *_arg)
|
||||
entropytxs = (CTransaction *)calloc(sizeof(*entropytxs),DICE_MINUTXOS);
|
||||
while ( 1 )
|
||||
{
|
||||
while ( KOMODO_INSYNC == 0 || (height= KOMODO_INSYNC) == lastht )
|
||||
while ( HUSH_INSYNC == 0 || (height= HUSH_INSYNC) == lastht )
|
||||
{
|
||||
sleep(3);
|
||||
}
|
||||
|
||||
@@ -792,9 +792,9 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block,uint32_t prevtim
|
||||
script = (uint8_t *)&block.vtx[0].vout[0].scriptPubKey[0];
|
||||
//int32_t notary = komodo_electednotary(&num,script+1,height,0);
|
||||
//if ( (-1 * (komodo_electednotary(&num,script+1,height,0) >= 0) * (height > 1000000)) < 0 )
|
||||
// fprintf(stderr, ">>>>>>> FAILED BLOCK.%d notary.%d insync.%d\n",height,notary,KOMODO_INSYNC);
|
||||
// fprintf(stderr, ">>>>>>> FAILED BLOCK.%d notary.%d insync.%d\n",height,notary,HUSH_INSYNC);
|
||||
//else
|
||||
// fprintf(stderr, "<<<<<<< VALID BLOCK.%d notary.%d insync.%d\n",height,notary,KOMODO_INSYNC);
|
||||
// fprintf(stderr, "<<<<<<< VALID BLOCK.%d notary.%d insync.%d\n",height,notary,HUSH_INSYNC);
|
||||
return(-1 * (komodo_electednotary(&num,script+1,height,0) >= 0) * (height > 1000000));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ unsigned int WITNESS_CACHE_SIZE = _COINBASE_MATURITY+10;
|
||||
uint256 KOMODO_EARLYTXID;
|
||||
|
||||
int32_t KOMODO_MININGTHREADS = -1,IS_KOMODO_NOTARY,IS_STAKED_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAINS_SEED,KOMODO_ON_DEMAND,KOMODO_EXTERNAL_NOTARIES,KOMODO_PASSPORT_INITDONE,KOMODO_PAX,KOMODO_EXCHANGEWALLET,KOMODO_REWIND,STAKED_ERA,KOMODO_CONNECTING = -1,KOMODO_DEALERNODE,KOMODO_EXTRASATOSHI,ASSETCHAINS_FOUNDERS,ASSETCHAINS_CBMATURITY,KOMODO_NSPV;
|
||||
int32_t KOMODO_INSYNC,KOMODO_LASTMINED,prevKOMODO_LASTMINED,KOMODO_CCACTIVATE,JUMBLR_PAUSE = 1;
|
||||
int32_t HUSH_INSYNC,KOMODO_LASTMINED,prevKOMODO_LASTMINED,KOMODO_CCACTIVATE,JUMBLR_PAUSE = 1;
|
||||
std::string NOTARY_PUBKEY,ASSETCHAINS_NOTARIES,ASSETCHAINS_OVERRIDE_PUBKEY,DONATION_PUBKEY,ASSETCHAINS_SCRIPTPUB,NOTARY_ADDRESS,ASSETCHAINS_SELFIMPORT,ASSETCHAINS_CCLIB;
|
||||
uint8_t NOTARY_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEYHASH[20],ASSETCHAINS_PUBLIC,ASSETCHAINS_PRIVATE,ASSETCHAINS_TXPOW,ASSETCHAINS_MARMARA;
|
||||
int8_t ASSETCHAINS_ADAPTIVEPOW;
|
||||
|
||||
16
src/main.cpp
16
src/main.cpp
@@ -79,7 +79,7 @@ using namespace std;
|
||||
#define TMPFILE_START 100000000
|
||||
CCriticalSection cs_main;
|
||||
extern uint8_t NOTARY_PUBKEY33[33];
|
||||
extern int32_t KOMODO_LOADINGBLOCKS,KOMODO_LONGESTCHAIN,KOMODO_INSYNC,KOMODO_CONNECTING,KOMODO_EXTRASATOSHI;
|
||||
extern int32_t KOMODO_LOADINGBLOCKS,KOMODO_LONGESTCHAIN,HUSH_INSYNC,KOMODO_CONNECTING,KOMODO_EXTRASATOSHI;
|
||||
int32_t KOMODO_NEWBLOCKS;
|
||||
int32_t komodo_block2pubkey33(uint8_t *pubkey33,CBlock *block);
|
||||
//void komodo_broadcast(CBlock *pblock,int32_t limit);
|
||||
@@ -2442,7 +2442,7 @@ bool IsInitialBlockDownload()
|
||||
}
|
||||
state = ((chainActive.Height() < ptr->GetHeight() - 24*60) ||
|
||||
ptr->GetBlockTime() < (GetTime() - nMaxTipAge));
|
||||
if ( KOMODO_INSYNC != 0 )
|
||||
if ( HUSH_INSYNC != 0 )
|
||||
state = false;
|
||||
if (!state)
|
||||
{
|
||||
@@ -4203,10 +4203,10 @@ bool static ConnectTip(CValidationState &state, CBlockIndex *pindexNew, CBlock *
|
||||
LogPrint("bench", " - Connect postprocess: %.2fms [%.2fs]\n", (nTime6 - nTime5) * 0.001, nTimePostConnect * 0.000001);
|
||||
LogPrint("bench", "- Connect block: %.2fms [%.2fs]\n", (nTime6 - nTime1) * 0.001, nTimeTotal * 0.000001);
|
||||
if ( KOMODO_LONGESTCHAIN != 0 && (pindexNew->GetHeight() == KOMODO_LONGESTCHAIN || pindexNew->GetHeight() == KOMODO_LONGESTCHAIN+1) )
|
||||
KOMODO_INSYNC = (int32_t)pindexNew->GetHeight();
|
||||
else KOMODO_INSYNC = 0;
|
||||
//fprintf(stderr,"connect.%d insync.%d ASSETCHAINS_SAPLING.%d\n",(int32_t)pindexNew->GetHeight(),KOMODO_INSYNC,ASSETCHAINS_SAPLING);
|
||||
/*if ( KOMODO_INSYNC != 0 ) //ASSETCHAINS_SYMBOL[0] == 0 &&
|
||||
HUSH_INSYNC = (int32_t)pindexNew->GetHeight();
|
||||
else HUSH_INSYNC = 0;
|
||||
//fprintf(stderr,"connect.%d insync.%d ASSETCHAINS_SAPLING.%d\n",(int32_t)pindexNew->GetHeight(),HUSH_INSYNC,ASSETCHAINS_SAPLING);
|
||||
/*if ( HUSH_INSYNC != 0 ) //ASSETCHAINS_SYMBOL[0] == 0 &&
|
||||
komodo_broadcast(pblock,8);
|
||||
else if ( ASSETCHAINS_SYMBOL[0] != 0 )
|
||||
komodo_broadcast(pblock,4);*/
|
||||
@@ -5471,7 +5471,7 @@ bool AcceptBlockHeader(int32_t *futureblockp,const CBlockHeader& block, CValidat
|
||||
*ppindex = pindex;
|
||||
if ( pindex != 0 && (pindex->nStatus & BLOCK_FAILED_MASK) != 0 )
|
||||
{
|
||||
if ( ASSETCHAINS_CC == 0 )//&& (ASSETCHAINS_PRIVATE == 0 || KOMODO_INSYNC >= Params().GetConsensus().vUpgrades[Consensus::UPGRADE_SAPLING].nActivationHeight) )
|
||||
if ( ASSETCHAINS_CC == 0 )//&& (ASSETCHAINS_PRIVATE == 0 || HUSH_INSYNC >= Params().GetConsensus().vUpgrades[Consensus::UPGRADE_SAPLING].nActivationHeight) )
|
||||
return state.Invalid(error("%s: block is marked invalid", __func__), 0, "duplicate");
|
||||
else
|
||||
{
|
||||
@@ -7606,7 +7606,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
||||
}
|
||||
else if (strCommand == "getnSPV")
|
||||
{
|
||||
if ( KOMODO_NSPV == 0 )//&& KOMODO_INSYNC != 0 )
|
||||
if ( KOMODO_NSPV == 0 )//&& HUSH_INSYNC != 0 )
|
||||
{
|
||||
std::vector<uint8_t> payload;
|
||||
vRecv >> payload;
|
||||
|
||||
@@ -1019,7 +1019,7 @@ int32_t komodo_baseid(char *origbase);
|
||||
int32_t komodo_eligiblenotary(uint8_t pubkeys[66][33],int32_t *mids,uint32_t *blocktimes,int32_t *nonzpkeysp,int32_t height);
|
||||
arith_uint256 komodo_PoWtarget(int32_t *percPoSp,arith_uint256 target,int32_t height,int32_t goalperc);
|
||||
int32_t FOUND_BLOCK,KOMODO_MAYBEMINED;
|
||||
extern int32_t KOMODO_LASTMINED,KOMODO_INSYNC;
|
||||
extern int32_t KOMODO_LASTMINED,HUSH_INSYNC;
|
||||
int32_t roundrobin_delay;
|
||||
arith_uint256 HASHTarget,HASHTarget_POW;
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
extern int32_t KOMODO_INSYNC;
|
||||
extern int32_t HUSH_INSYNC;
|
||||
extern bool fZindex;
|
||||
extern void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue& entry);
|
||||
void ScriptPubKeyToJSON(const CScript& scriptPubKey, UniValue& out, bool fIncludeHex);
|
||||
@@ -1658,7 +1658,7 @@ UniValue getblockchaininfo(const UniValue& params, bool fHelp, const CPubKey& my
|
||||
UniValue obj(UniValue::VOBJ);
|
||||
obj.push_back(Pair("chain", Params().NetworkIDString()));
|
||||
obj.push_back(Pair("blocks", (int)chainActive.Height()));
|
||||
obj.push_back(Pair("synced", KOMODO_INSYNC!=0));
|
||||
obj.push_back(Pair("synced", HUSH_INSYNC!=0));
|
||||
obj.push_back(Pair("longestchain", KOMODO_LONGESTCHAIN));
|
||||
obj.push_back(Pair("notarized", notarized_height));
|
||||
obj.push_back(Pair("headers", pindexBestHeader ? pindexBestHeader->GetHeight() : -1));
|
||||
@@ -1887,7 +1887,7 @@ inline CBlockIndex* LookupBlockIndex(const uint256& hash)
|
||||
|
||||
UniValue getchaintxstats(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
{
|
||||
THROW_IF_SYNCING(KOMODO_INSYNC);
|
||||
THROW_IF_SYNCING(HUSH_INSYNC);
|
||||
|
||||
if (fHelp || params.size() > 2)
|
||||
throw runtime_error(
|
||||
|
||||
@@ -70,7 +70,7 @@ bool komodo_txnotarizedconfirmed(uint256 txid);
|
||||
uint32_t komodo_chainactive_timestamp();
|
||||
int32_t komodo_whoami(char *pubkeystr,int32_t height,uint32_t timestamp);
|
||||
extern uint64_t KOMODO_INTERESTSUM,KOMODO_WALLETBALANCE;
|
||||
extern int32_t KOMODO_LASTMINED,JUMBLR_PAUSE,KOMODO_LONGESTCHAIN,IS_STAKED_NOTARY,IS_KOMODO_NOTARY,STAKED_ERA,KOMODO_INSYNC;
|
||||
extern int32_t KOMODO_LASTMINED,JUMBLR_PAUSE,KOMODO_LONGESTCHAIN,IS_STAKED_NOTARY,IS_KOMODO_NOTARY,STAKED_ERA,HUSH_INSYNC;
|
||||
extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN];
|
||||
uint32_t komodo_segid32(char *coinaddr);
|
||||
int64_t komodo_coinsupply(int64_t *zfundsp,int64_t *sproutfundsp,int32_t height);
|
||||
@@ -240,7 +240,7 @@ UniValue getinfo(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
// this KMD version represents the last time we did a full merge, we only cherry-pick or take nothing
|
||||
// in the post-KYC "era" of KMD
|
||||
obj.push_back(Pair("KMDversion", KOMODO_VERSION)); // never change this again, it's set in stone. -- Duke
|
||||
obj.push_back(Pair("synced", KOMODO_INSYNC!=0));
|
||||
obj.push_back(Pair("synced", HUSH_INSYNC!=0));
|
||||
// any height larger than this can be attacked!
|
||||
obj.push_back(Pair("notarized", notarized_height));
|
||||
obj.push_back(Pair("prevMoMheight", prevMoMheight));
|
||||
|
||||
@@ -6,10 +6,13 @@
|
||||
#include "chainparams.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "crypto/common.h"
|
||||
#include "testutils.h"
|
||||
//#include "testutils.h"
|
||||
|
||||
std::string notaryPubkey = "0205a8ad0c1dbc515f149af377981aab58b836af008d4d7ab21bd76faf80550b47";
|
||||
std::string notarySecret = "UxFWWxsf1d7w7K5TvAWSkeX4H95XQKwdwGv49DXwWUTzPTTjHBbU";
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
/*
|
||||
assert(init_and_check_sodium() != -1);
|
||||
ECC_Start();
|
||||
ECCVerifyHandle handle; // Inits secp256k1 verify context
|
||||
@@ -18,7 +21,8 @@ int main(int argc, char **argv) {
|
||||
CBitcoinSecret vchSecret;
|
||||
// this returns false due to network prefix mismatch but works anyway
|
||||
vchSecret.SetString(notarySecret);
|
||||
notaryKey = vchSecret.GetKey();
|
||||
CKey notaryKey = vchSecret.GetKey();
|
||||
*/
|
||||
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
return RUN_ALL_TESTS();
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include <cryptoconditions.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
#include "core_io.h"
|
||||
#include "key.h"
|
||||
#include "main.h"
|
||||
@@ -21,7 +20,6 @@
|
||||
#include "primitives/transaction.h"
|
||||
#include "script/cc.h"
|
||||
#include "script/interpreter.h"
|
||||
|
||||
#include "testutils.h"
|
||||
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN];
|
||||
extern std::string ASSETCHAINS_OVERRIDE_PUBKEY;
|
||||
const std::string ADDR_TYPE_SAPLING = "sapling";
|
||||
const std::string ADDR_TYPE_AMNESIA = "amnesia";
|
||||
extern int32_t KOMODO_INSYNC;
|
||||
extern int32_t HUSH_INSYNC;
|
||||
uint32_t komodo_segid32(char *coinaddr);
|
||||
int32_t komodo_dpowconfs(int32_t height,int32_t numconfs);
|
||||
int32_t komodo_isnotaryvout(char *coinaddr,uint32_t tiptime); // from ac_private chains only
|
||||
@@ -4640,7 +4640,7 @@ UniValue z_sendmany(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
|
||||
THROW_IF_SYNCING(KOMODO_INSYNC);
|
||||
THROW_IF_SYNCING(HUSH_INSYNC);
|
||||
|
||||
// Check that the from address is valid.
|
||||
auto fromaddress = params[0].get_str();
|
||||
@@ -4962,7 +4962,7 @@ UniValue z_shieldcoinbase(const UniValue& params, bool fHelp, const CPubKey& myp
|
||||
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
|
||||
THROW_IF_SYNCING(KOMODO_INSYNC);
|
||||
THROW_IF_SYNCING(HUSH_INSYNC);
|
||||
|
||||
// Validate the from address
|
||||
auto fromaddress = params[0].get_str();
|
||||
@@ -5218,7 +5218,7 @@ UniValue z_mergetoaddress(const UniValue& params, bool fHelp, const CPubKey& myp
|
||||
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
|
||||
THROW_IF_SYNCING(KOMODO_INSYNC);
|
||||
THROW_IF_SYNCING(HUSH_INSYNC);
|
||||
|
||||
bool useAnyUTXO = false;
|
||||
bool useAnySapling = false;
|
||||
|
||||
Reference in New Issue
Block a user