Merge branch 'dev' into opreturnfee

This commit is contained in:
duke
2025-03-02 10:09:56 -06:00
24 changed files with 156 additions and 365 deletions

BIN
asmap.dat

Binary file not shown.

View File

@@ -3,12 +3,12 @@ AC_PREREQ([2.60])
define(_CLIENT_VERSION_MAJOR, 3)
dnl Must be kept in sync with src/clientversion.h , ugh!
define(_CLIENT_VERSION_MINOR, 10)
define(_CLIENT_VERSION_REVISION, 3)
define(_CLIENT_VERSION_REVISION, 4)
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)))
define(_CLIENT_VERSION_IS_RELEASE, true)
define(_COPYRIGHT_YEAR, 2024)
define(_COPYRIGHT_YEAR, 2025)
AC_INIT([Hush],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_SUFFIX(_ZC_BUILD_VAL)],[https://git.hush.is/hush/hush3],[hush])
AC_CONFIG_SRCDIR([src/main.cpp])
AC_CONFIG_HEADERS([src/config/bitcoin-config.h])

View File

@@ -2,4 +2,5 @@
Files relating to -asmap=... feature, to use ASNs
Originally from https://github.com/sipa/asmap/blob/master/demo.map
From https://github.com/asmap/asmap-data/blob/main/1730210400_asmap.dat
[Upstream Commit dcce69e48211facdbd52a461cfce333d5800b7de](https://github.com/asmap/asmap-data/commit/dcce69e48211facdbd52a461cfce333d5800b7de)

Binary file not shown.

57
contrib/avg_blocktime.pl Executable file
View File

@@ -0,0 +1,57 @@
#!/usr/bin/perl
# Copyright (c) 2016-2022 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
use warnings;
use strict;
my $cli = "./src/hush-cli";
my $coin = shift || '';
unless (-e $cli) {
die "$cli does not exist, aborting";
}
if ($coin) {
$cli .= " -ac_name=$coin";
}
my $getblock= "$cli getblock";
my $start = shift || 1850000;
my $end = shift || 1853000;
my $blocks = qx{$cli getblockcount};
if($?) {
print "ERROR, is node running? exiting...\n";
exit 1;
}
if ($end > $blocks) {
print "The block $end is beyond how many blocks this node knows about, exiting...\n";
exit 1;
}
if ($start < 1) {
print "Invalid start block $start, exiting...\n";
exit 1;
}
my $block = $start;
my $prev_blocktime = 0;
my $total_duration = 0;
while ($block <= $end) {
my $blocktime = qx{$getblock $block | grep time};
chomp $blocktime;
if($blocktime =~ m/(\d+)/) {
$blocktime = $1;
}
my $duration = $blocktime - $prev_blocktime;
if($prev_blocktime > 0) {
$total_duration += $duration;
}
#print "$block $blocktime $prev_blocktime $duration\n";
print "$block $duration\n";
$block++;
$prev_blocktime = $blocktime;
}
my $num_blocks = $end - $start;
my $avg_duration = $total_duration / $num_blocks;
print "Avg blocktime over $num_blocks blocks = $avg_duration\n";

View File

@@ -5,7 +5,7 @@
use warnings;
use strict;
# Given a block time, estimate when it will happen
# Given a block height, estimate when it will happen
my $block = shift || die "Usage: $0 123";
my $coin = shift || '';
my $hush = "./src/hush-cli";
@@ -30,7 +30,7 @@ if ($block <= $blockcount) {
if ($coin eq 'DRAGONX') {
$minpb = 0.6; # minutes per block
} elsif ($coin) {
# TODO: support custom bloctimes
# TODO: support custom blocktimes
$minpb = 1; # assumes default blocktime of 60s
}
my $minutes = $diff*$minpb;

View File

@@ -1 +1 @@
9
13

View File

@@ -1 +1 @@
DEBIAN/examples/zcash.conf
DEBIAN/examples/HUSH3.conf

View File

@@ -8,7 +8,11 @@
use warnings;
use strict;
my $hush = "./src/hush-cli";
# call this script like this to generate checkpoints for a HAC such as DragonX:
# CLI=./src/dragonx-cli ./contrib/sdl_checkpoints.pl ...
my $hush = $ENV{CLI} || "./src/hush-cli";
my $gethash = "$hush getblockhash";
my $gettree = "$hush getblockmerkletree";
my $start = shift || 300000;

View File

@@ -106,10 +106,7 @@ details.
## CJDNS-related information in Hush
There are several ways to see your CJDNS address in Hush:
- in the "Local addresses" output of CLI `-netinfo`
- in the "localaddresses" output of RPC `getnetworkinfo`
To see which CJDNS peers your node is connected to, use `hush-cli -netinfo 4`
or the `getpeerinfo` RPC (i.e. `hush-cli getpeerinfo`).
You can use the `getnodeaddresses` RPC to fetch a number of CJDNS peers known to your node; run `hush-cli help getnodeaddresses` for details.
To see which CJDNS peers your node is connected to, use `hush-cli getpeerinfo`
RPC.

View File

@@ -100,15 +100,11 @@ address.
There are several ways to see your I2P address if accepting
incoming I2P connections (`-i2pacceptincoming`):
- in the "Local addresses" output of CLI `-netinfo`
- in the "localaddresses" output of RPC `getnetworkinfo`
- in the debug log (grep for `AddLocal`; the I2P address ends in `.b32.i2p`)
- in the i2p/i2pd web console under "SAM Sessions"
To see which I2P peers your node is connected to, use `hush-cli -netinfo 4`
or the `getpeerinfo` RPC (e.g. `hush-cli getpeerinfo`).
To see which I2P addresses your node knows, use the `getnodeaddresses 0 i2p`
To see which I2P peers your node is connected to, use `hush-cli getpeerinfo`
RPC.
## Compatibility

View File

@@ -58,7 +58,7 @@ Look for Git issues that should be fixed in the next release. Especially low-ris
Install deps on Linux:
apt-get install help2man debchange
apt-get install help2man devscripts
## Release process
- If new seeds are being added or seeds are changing:

View File

@@ -10,6 +10,10 @@ and no longer on Github, since they banned Duke Leto and
also because they censor many people around the world and work with
evil organizations.
# Hush 3.10.4 ""
* Add CLI options `-disableipv4` and `-disableipv6` which can be used to disable IPv4/IPv6
* Updated ASmap, which maps IP addresses to Autonomous System (AS) numbers
# Hush 3.10.3 "Persistent Pezoporus"
* Use WolfSSL 4.8.1 which prevents nodes from getting stuck in general and when shutting down

View File

@@ -16,7 +16,6 @@ configure Tor.
## How to see information about your Tor configuration via Hush
There are several ways to see your local onion address in Hush:
- in the "Local addresses" output of CLI `-netinfo`
- in the "localaddresses" output of RPC `getnetworkinfo`
- in the debug log (grep for "AddLocal"; the Tor address ends in `.onion`)
@@ -27,9 +26,6 @@ CLI `-addrinfo` returns the number of addresses known to your node per
network. This can be useful to see how many onion peers your node knows,
e.g. for `-onlynet=onion`.
To fetch a number of onion addresses that your node knows, for example seven
addresses, use the `getnodeaddresses 7 onion` RPC.
## 1. Run Hush behind a Tor proxy
The first step is running Hush behind a Tor proxy. This will already anonymize all

View File

@@ -47,49 +47,6 @@
#define SATOSHIDEN ((uint64_t)100000000L)
#define dstr(x) ((double)(x) / SATOSHIDEN)
#define CCDISABLEALL memset(ASSETCHAINS_CCDISABLES,1,sizeof(ASSETCHAINS_CCDISABLES))
#define CCENABLE(x) ASSETCHAINS_CCDISABLES[((uint8_t)x)] = 0
/* moved to hush_cJSON.h
#ifndef _BITS256
#define _BITS256
union _bits256 { uint8_t bytes[32]; uint16_t ushorts[16]; uint32_t uints[8]; uint64_t ulongs[4]; uint64_t txid; };
typedef union _bits256 bits256;
#endif
*/
/// \endcond
/// identifiers of additional data blobs in token opreturn script:
/// @see EncodeTokenCreateOpRet(uint8_t funcid, std::vector<uint8_t> origpubkey, std::string name, std::string description, std::vector<std::pair<uint8_t, vscript_t>> oprets)
/// @see GetOpretBlob
enum opretid : uint8_t {
// cc contracts data:
OPRETID_NONFUNGIBLEDATA = 0x11, //!< NFT data id
OPRETID_ASSETSDATA = 0x12, //!< assets contract data id
OPRETID_GATEWAYSDATA = 0x13, //!< gateways contract data id
OPRETID_CHANNELSDATA = 0x14, //!< channels contract data id
OPRETID_HEIRDATA = 0x15, //!< heir contract data id
OPRETID_ROGUEGAMEDATA = 0x16, //!< rogue contract data id
OPRETID_PEGSDATA = 0x17, //!< pegs contract data id
/*! \cond INTERNAL */
// non cc contract data:
OPRETID_FIRSTNONCCDATA = 0x80,
/*! \endcond */
OPRETID_BURNDATA = 0x80, //!< burned token data id
OPRETID_IMPORTDATA = 0x81 //!< imported token data id
};
/// finds opret blob data by opretid in the vector of oprets
/// @param oprets vector of oprets
/// @param id opret id to search
/// @param vopret found opret blob as byte array
/// @returns true if found
/// @see opretid
inline bool GetOpretBlob(const std::vector<std::pair<uint8_t, std::vector<uint8_t>>> &oprets, uint8_t id, std::vector<uint8_t> &vopret) {
vopret.clear();
for(auto p : oprets) if (p.first == id) { vopret = p.second; return true; }
return false;
}
/// \cond INTERNAL
struct CC_utxo
@@ -100,16 +57,6 @@ struct CC_utxo
};
/// \endcond
/// \cond INTERNAL
struct CC_meta
{
std::vector<unsigned char> version;
uint8_t evalCode;
bool is1of2;
uint8_t numDestinations;
// followed by address destinations
};
/// \endcond
/// CC contract (Antara module) info structure that contains data used for signing and validation of cc contract transactions
struct CCcontract_info
@@ -184,16 +131,6 @@ struct CCcontract_info
/// @returns pointer to the passed CCcontract_info structure, it must not be freed
struct CCcontract_info *CCinit(struct CCcontract_info *cp,uint8_t evalcode);
/// \cond INTERNAL
struct oracleprice_info
{
CPubKey pk;
std::vector <uint8_t> data;
int32_t height;
};
/// \endcond
typedef std::vector<uint8_t> vscript_t;
extern struct NSPV_CCmtxinfo NSPV_U; //!< global variable with info about mtx object and used utxo
@@ -258,7 +195,6 @@ bool myIsutxo_spentinmempool(uint256 &spenttxid,int32_t &spentvini,uint256 txid,
bool myAddtomempool(CTransaction &tx, CValidationState *pstate = NULL, bool fSkipExpiry = false);
bool mytxid_inmempool(uint256 txid);
int32_t myIsutxo_spent(uint256 &spenttxid,uint256 txid,int32_t vout);
int32_t myGet_mempool_txs(std::vector<CTransaction> &txs,uint8_t evalcode,uint8_t funcid);
/// \endcond
/// \cond INTERNAL
@@ -393,52 +329,6 @@ bool getCCopret(const CScript &scriptPubKey, CScript &opret);
/// @private
bool makeCCopret(CScript &opret, std::vector<std::vector<unsigned char>> &vData);
/// CCaddr2set sets private key for additional eval code global address.
/// This allows to spend from two cc global addresses in one transaction (the first one is set in cp object by @see CCinit function).
/// @param cp contract info structure (@see CCcontract_info) where the private key is set
/// @param evalcode eval code of the other contract
/// @param pk global public key of the other contract
/// @param priv private key for the global public key of the other contract
/// @param coinaddr cc address obtained for this global pubkey and eval code with _GetCCaddress
/// @see CCinit
/// @see CCcontract_info
/// @see _GetCCaddress
void CCaddr2set(struct CCcontract_info *cp,uint8_t evalcode,CPubKey pk,uint8_t *priv,char *coinaddr);
/// CCaddr2set sets private key for yet another eval code global address.
/// This allows to spend from three cc global addresses in one transaction (the first one is set in cp object by CCinit function, the second is set by CCaddr2set function).
/// @param cp contract info structure where the private key is set
/// @param evalcode eval code of the other contract
/// @param pk global public key of the other contract
/// @param priv private key for the global public key of the other contract
/// @param coinaddr the cc address obtained for this global pubkey and eval code with _GetCCaddress
/// @see CCinit
/// @see CCcontract_info
/// @see CCaddr2set
/// @see _GetCCaddress
void CCaddr3set(struct CCcontract_info *cp,uint8_t evalcode,CPubKey pk,uint8_t *priv,char *coinaddr);
/// CCaddr1of2set sets pubkeys, private key and cc addr for spending from 1of2 cryptocondition vout
/// @param cp contract info structure where the private key is set
/// @param pk1 one of the two public keys of the 1of2 cc
/// @param pk2 second of the two public keys of the 1of2 cc
/// @param priv private key for one of the two pubkeys
/// @param coinaddr the cc address obtained for this 1of2 cc with GetCCaddress1of2
/// @see CCinit
/// @see CCcontract_info
/// @see GetCCaddress1of2
void CCaddr1of2set(struct CCcontract_info *cp, CPubKey pk1, CPubKey pk2,uint8_t *priv,char *coinaddr);
/// CCaddrTokens1of2set sets pubkeys, private key and cc addr for spending from 1of2 token cryptocondition vout
/// @param cp contract info structure where the private key is set
/// @param pk1 one of the two public keys of the 1of2 cc
/// @param pk2 second of the two public keys of the 1of2 cc
/// @param priv private key for one of the two pubkeys
/// @param coinaddr the cc address obtained for this 1of2 token cc with GetTokensCCaddress1of2
/// @see GetTokensCCaddress
/// @see CCcontract_info
void CCaddrTokens1of2set(struct CCcontract_info *cp, CPubKey pk1, CPubKey pk2, uint8_t *priv, char *coinaddr);
/// IsCCInput checks if scriptSig object contains a cryptocondition
/// @param scriptSig scriptSig object with a cryptocondition
/// @returns true if the scriptSig object contains a cryptocondition
@@ -476,8 +366,6 @@ CPubKey pubkey2pk(std::vector<uint8_t> vpubkey);
/// @param tokenid id of token (id of token creation tx)
int64_t CCfullsupply(uint256 tokenid);
/// @private
bool ConstrainVout(CTxOut vout,int32_t CCflag,char *cmpaddr,int64_t nValue);
/// Returns bitcoin address for the scriptPubKey parameter
/// @param[out] destaddr the returned address of the scriptPubKey, the buffer should have size of at least 64 chars
@@ -485,15 +373,6 @@ bool ConstrainVout(CTxOut vout,int32_t CCflag,char *cmpaddr,int64_t nValue);
/// @returns true if success
bool Getscriptaddress(char *destaddr,const CScript &scriptPubKey);
/// Returns custom bitcoin address for the scriptPubKey parameter
/// @param[out] destaddr the returned address of the scriptPubKey, the buffer should have size of at least 64 chars
/// @param scriptPubKey scriptPubKey object
/// @param taddr custom address prefix
/// @param prefix custom pubkey prefix
/// @param prefix2 custom script prefix
/// @returns true if success
bool GetCustomscriptaddress(char *destaddr,const CScript &scriptPubKey,uint8_t taddr,uint8_t prefix,uint8_t prefix2);
/// Returns my pubkey, that is set by -pubkey hushd parameter
/// @returns public key as byte array
std::vector<uint8_t> Mypubkey();
@@ -633,9 +512,6 @@ bits256 bits256_doublesha256(char *deprecated,uint8_t *data,int32_t datalen);
// UniValue ValueFromAmount(const CAmount& amount); // defined in server.h
/*! \endcond */
/*! \cond INTERNAL */
int64_t TotalPubkeyNormalInputs(const CTransaction &tx, const CPubKey &pubkey);
int64_t TotalPubkeyCCInputs(const CTransaction &tx, const CPubKey &pubkey);
inline std::string STR_TOLOWER(const std::string &str) { std::string out; for (std::string::const_iterator i = str.begin(); i != str.end(); i++) out += std::tolower(*i); return out; }
/*! \endcond */
@@ -646,60 +522,4 @@ inline std::string STR_TOLOWER(const std::string &str) { std::string out; for (s
void AddSigData2UniValue(UniValue &result, int32_t vini, UniValue& ccjson, std::string sscriptpubkey, int64_t amount);
#ifndef LOGSTREAM_DEFINED
#define LOGSTREAM_DEFINED
// bitcoin LogPrintStr with category "-debug" cmdarg support for C++ ostringstream:
// log levels:
#define CCLOG_ERROR (-1) //!< error level
#define CCLOG_INFO 0 //!< info level
#define CCLOG_DEBUG1 1 //!< debug level 1
#define CCLOG_DEBUG2 2 //!< debug level 2
#define CCLOG_DEBUG3 3 //!< debug level 3
#define CCLOG_MAXLEVEL 3
/// @private
extern void CCLogPrintStr(const char *category, int level, const std::string &str);
/// @private
template <class T>
void CCLogPrintStream(const char *category, int level, const char *functionName, T print_to_stream)
{
}
/// Macro for logging messages using bitcoin LogAcceptCategory and LogPrintStr functions.
/// Supports error, info and three levels of debug messages.
/// Logging category is set by -debug=category hushd param.
/// To set debug level pass -debug=category-1, -debug=category-2 or -debug=category-3 param. If some level is enabled lower level messages also will be printed.
/// To print info-level messages pass just -debug=category parameter, with no level.
/// Error-level messages will always be printed, even if -debug parameter is not set
/// @param category category of message, for example Antara module name
/// @param level debug-level, use defines CCLOG_ERROR, CCLOG_INFO, CCLOG_DEBUGN
/// @param logoperator to form the log message (the 'stream' name is mandatory)
/// usage: LOGSTREAM("category", debug-level, stream << "some log data" << data2 << data3 << ... << std::endl);
/// example: LOGSTREAM("heir", CCLOG_INFO, stream << "heir public key is " << HexStr(heirPk) << std::endl);
#define LOGSTREAM(category, level, logoperator) CCLogPrintStream( category, level, NULL, [=](std::ostringstream &stream) {logoperator;} )
/// LOGSTREAMFN is a version of LOGSTREAM macro which adds calling function name with the standard define \_\_func\_\_ at the beginning of the printed string.
/// LOGSTREAMFN parameters are the same as in LOGSTREAM
/// @see LOGSTREAM
#define LOGSTREAMFN(category, level, logoperator) CCLogPrintStream( category, level, __func__, [=](std::ostringstream &stream) {logoperator;} )
/// @private
template <class T>
UniValue report_ccerror(const char *category, int level, T print_to_stream)
{
UniValue err(UniValue::VOBJ);
std::ostringstream stream;
print_to_stream(stream);
err.push_back(Pair("result", "error"));
err.push_back(Pair("error", stream.str()));
stream << std::endl;
CCLogPrintStr(category, level, stream.str());
return err;
}
/// @private
#define CCERR_RESULT(category,level,logoperator) return report_ccerror(category, level, [=](std::ostringstream &stream) {logoperator;})
#endif // #ifndef LOGSTREAM_DEFINED
#endif

View File

@@ -102,7 +102,3 @@ CPubKey pubkey2pk(std::vector<uint8_t> vpubkey)
pk.Set(vpubkey.begin(), vpubkey.end());
return(pk);
}
void CCLogPrintStr(const char *category, int level, const std::string &str)
{
}

View File

@@ -100,22 +100,6 @@ uint32_t GetLatestTimestamp(int32_t height)
return(hush_heightstamp(height));
} // :P
void CCaddr2set(struct CCcontract_info *cp,uint8_t evalcode,CPubKey pk,uint8_t *priv,char *coinaddr)
{
}
void CCaddr3set(struct CCcontract_info *cp,uint8_t evalcode,CPubKey pk,uint8_t *priv,char *coinaddr)
{
}
void CCaddr1of2set(struct CCcontract_info *cp, CPubKey pk1, CPubKey pk2, uint8_t *priv, char *coinaddr)
{
}
void CCaddrTokens1of2set(struct CCcontract_info *cp, CPubKey pk1, CPubKey pk2, uint8_t *priv, char *tokenaddr)
{
}
bool Getscriptaddress(char *destaddr,const CScript &scriptPubKey)
{
CTxDestination address; txnouttype whichType;
@@ -132,11 +116,6 @@ bool Getscriptaddress(char *destaddr,const CScript &scriptPubKey)
return(false);
}
bool GetCustomscriptaddress(char *destaddr,const CScript &scriptPubKey,uint8_t taddr,uint8_t prefix, uint8_t prefix2)
{
return(false);
}
bool pubkey2addr(char *destaddr,uint8_t *pubkey33)
{
std::vector<uint8_t>pk; int32_t i;
@@ -145,11 +124,6 @@ bool pubkey2addr(char *destaddr,uint8_t *pubkey33)
return(Getscriptaddress(destaddr,CScript() << pk << OP_CHECKSIG));
}
bool ConstrainVout(CTxOut vout, int32_t CCflag, char *cmpaddr, int64_t nValue)
{
return false;
}
bool priv2addr(char *coinaddr,uint8_t *buf33,uint8_t priv32[32])
{
CKey priv; CPubKey pk; int32_t i; uint8_t *src;
@@ -189,57 +163,9 @@ CPubKey GetUnspendable(struct CCcontract_info *cp,uint8_t *unspendablepriv)
int32_t NSPV_coinaddr_inmempool(char const *logcategory,char *coinaddr,uint8_t CCflag);
int32_t myIs_coinaddr_inmempoolvout(char const *logcategory,char *coinaddr)
{
int32_t i,n; char destaddr[64];
if ( HUSH_NSPV_SUPERLITE )
return(NSPV_coinaddr_inmempool(logcategory,coinaddr,1));
BOOST_FOREACH(const CTxMemPoolEntry &e,mempool.mapTx)
{
const CTransaction &tx = e.GetTx();
if ( (n= tx.vout.size()) > 0 )
{
const uint256 &txid = tx.GetHash();
for (i=0; i<n; i++)
{
Getscriptaddress(destaddr,tx.vout[i].scriptPubKey);
if ( strcmp(destaddr,coinaddr) == 0 )
{
LogPrint(logcategory,"found (%s) vout in mempool\n",coinaddr);
return(1);
}
}
}
}
return(0);
}
extern struct NSPV_mempoolresp NSPV_mempoolresult;
extern bool NSPV_evalcode_inmempool(uint8_t evalcode,uint8_t funcid);
int32_t myGet_mempool_txs(std::vector<CTransaction> &txs,uint8_t evalcode,uint8_t funcid)
{
int i=0;
if ( HUSH_NSPV_SUPERLITE )
{
CTransaction tx; uint256 hashBlock;
NSPV_evalcode_inmempool(evalcode,funcid);
for (int i=0;i<NSPV_mempoolresult.numtxids;i++)
{
if (myGetTransaction(NSPV_mempoolresult.txids[i],tx,hashBlock)!=0) txs.push_back(tx);
}
return (NSPV_mempoolresult.numtxids);
}
BOOST_FOREACH(const CTxMemPoolEntry &e,mempool.mapTx)
{
txs.push_back(e.GetTx());
i++;
}
return(i);
}
/* Get the block merkle root for a proof
* IN: proofData
* OUT: merkle root
@@ -327,16 +253,4 @@ bool hush_txnotarizedconfirmed(uint256 txid)
return (false);
}
// returns total of normal inputs signed with this pubkey
int64_t TotalPubkeyNormalInputs(const CTransaction &tx, const CPubKey &pubkey)
{
return 0;
}
// returns total of CC inputs signed with this pubkey
int64_t TotalPubkeyCCInputs(const CTransaction &tx, const CPubKey &pubkey)
{
return 0;
}
extern std::string MYCCLIBNAME;

View File

@@ -1,6 +1,6 @@
// Copyright (c) 2009-2014 The Bitcoin Core developers
// Copyright (c) 2016-2017 The Zcash developers
// Copyright (c) 2016-2024 The Hush developers
// Copyright (c) 2016-2025 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?
@@ -30,7 +30,7 @@
// Must be kept in sync with configure.ac , ugh!
#define CLIENT_VERSION_MAJOR 3
#define CLIENT_VERSION_MINOR 10
#define CLIENT_VERSION_REVISION 3
#define CLIENT_VERSION_REVISION 4
#define CLIENT_VERSION_BUILD 50
//! Set to true for release, false for prerelease or test build

View File

@@ -294,69 +294,9 @@ int32_t NSPV_mempoolfuncs(bits256 *satoshisp,int32_t *vindexp,std::vector<uint25
int32_t num = 0,vini = 0,vouti = 0; uint8_t evalcode=0,func=0; std::vector<uint8_t> vopret; char destaddr[64];
*vindexp = -1;
memset(satoshisp,0,sizeof(*satoshisp));
/*
if ( funcid == NSPV_CC_TXIDS)
{
std::vector<std::pair<CAddressIndexKey, CAmount> > tmp_txids; uint256 tmp_txid,hashBlock;
int32_t n=0,skipcount=vout>>16; uint8_t eval=(vout>>8)&0xFF, func=vout&0xFF;
CTransaction tx;
SetCCtxids(tmp_txids,coinaddr,isCC);
if ( skipcount < 0 ) skipcount = 0;
if ( skipcount >= tmp_txids.size() )
skipcount = tmp_txids.size()-1;
if ( tmp_txids.size()-skipcount > 0 )
{
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=tmp_txids.begin(); it!=tmp_txids.end(); it++)
{
if (txid!=zeroid || func!=0)
{
myGetTransaction(it->first.txhash,tx,hashBlock);
std::vector<std::pair<uint8_t, vscript_t>> oprets; uint256 tokenid,txid;
std::vector<uint8_t> vopret,vOpretExtra; uint8_t *script,e,f,tokenevalcode;
std::vector<CPubKey> pubkeys;
if (DecodeTokenOpRet(tx.vout[tx.vout.size()-1].scriptPubKey,tokenevalcode,tokenid,pubkeys,oprets)!=0 && GetOpretBlob(oprets, OPRETID_CHANNELSDATA, vOpretExtra) && tokenevalcode==EVAL_TOKENS && vOpretExtra.size()>0)
{
vopret=vOpretExtra;
}
else GetOpReturnData(tx.vout[tx.vout.size()-1].scriptPubKey, vopret);
script = (uint8_t *)vopret.data();
if ( vopret.size() > 2 && script[0]==eval )
{
switch (eval)
{
case EVAL_CHANNELS:EVAL_PEGS:EVAL_ORACLES:EVAL_GAMES:EVAL_IMPORTGATEWAY:EVAL_ROGUE:
E_UNMARSHAL(vopret,ss >> e; ss >> f; ss >> tmp_txid;);
if (e!=eval || (txid!=zeroid && txid!=tmp_txid) || (func!=0 && f!=func)) continue;
break;
case EVAL_TOKENS:EVAL_DICE:EVAL_DILITHIUM:EVAL_FAUCET:EVAL_LOTO:EVAL_PAYMENTS:EVAL_REWARDS:
E_UNMARSHAL(vopret,ss >> e; ss >> f;);
if (e!=eval || (func!=0 && f!=func)) continue;
break;
default:
break;
}
}
}
if ( n >= skipcount ) txids.push_back(it->first.txhash);
n++;
}
return (n-skipcount);
}
return (0);
}
*/
if ( mempool.size() == 0 )
return(0);
/*
if ( funcid == NSPV_MEMPOOL_CCEVALCODE )
{
isCC = true;
evalcode = vout & 0xff;
func = (vout >> 8) & 0xff;
}
*/
LOCK(mempool.cs);
BOOST_FOREACH(const CTxMemPoolEntry &e,mempool.mapTx)
{

View File

@@ -429,8 +429,8 @@ std::string HelpMessage(HelpMessageMode mode)
strUsage += HelpMessageOpt("-i2psam=<ip:port>", strprintf(_("I2P SAM proxy to reach I2P peers and accept I2P connections (default: none)")));
strUsage += HelpMessageOpt("-i2pacceptincoming", strprintf(_("If set and -i2psam is also set then incoming I2P connections are accepted via the SAM proxy. If this is not set but -i2psam is set then only outgoing connections will be made to the I2P network. Ignored if -i2psam is not set. Listening for incoming I2P connections is done through the SAM proxy, not by binding to a local address and port (default: 1)")));
strUsage += HelpMessageOpt("-onlynet=<net>", _("Only connect to nodes in network <net> (ipv4, ipv6, onion or i2p)"));
strUsage += HelpMessageOpt("-disableipv4", _("Disable Ipv4 network connections") + " " + _("(default: 0)"));
strUsage += HelpMessageOpt("-disableipv6", _("Disable Ipv6 network connections") + " " + _("(default: 0)"));
strUsage += HelpMessageOpt("-disableipv4", _("Disable Ipv4 network connections") + " " + strprintf(_("(default: %u)"), DEFAULT_DISABLE_IPV4));
strUsage += HelpMessageOpt("-disableipv6", _("Disable Ipv6 network connections") + " " + strprintf(_("(default: %u)"), DEFAULT_DISABLE_IPV6));
strUsage += HelpMessageOpt("-permitbaremultisig", strprintf(_("Relay non-P2SH multisig (default: %u)"), 1));
strUsage += HelpMessageOpt("-peerbloomfilters", strprintf(_("Support filtering of blocks and transaction with Bloom filters (default: %u)"), 1));
@@ -1647,8 +1647,13 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
std::set<enum Network> nets;
BOOST_FOREACH(const std::string& snet, mapMultiArgs["-onlynet"]) {
enum Network net = ParseNetwork(snet);
if (net == NET_UNROUTABLE)
if (net == NET_UNROUTABLE) {
return InitError(strprintf(_("Unknown network specified in -onlynet: '%s'"), snet));
} else if (net == NET_IPV4 && GetBoolArg("-disableipv4", DEFAULT_DISABLE_IPV4)) {
return InitError(strprintf(_("-onlynet=ipv4 is incompatible with -disableipv4 !")));
} else if (net == NET_IPV6 && GetBoolArg("-disableipv6", DEFAULT_DISABLE_IPV4)) {
return InitError(strprintf(_("-onlynet=ipv6 is incompatible with -disableipv6 !")));
}
nets.insert(net);
}
for (int n = 0; n < NET_MAX; n++) {
@@ -1658,6 +1663,22 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
}
}
if(mapMultiArgs["-disableipv6"].size() > 1) {
return InitError("-disableipv6 can only be used once");
}
if(mapMultiArgs["-disableipv4"].size() > 1) {
return InitError("-disableipv4 can only be used once");
}
if (GetBoolArg("-disableipv6", DEFAULT_DISABLE_IPV6)) {
SetReachable(NET_IPV6, false);
}
if (GetBoolArg("-disableipv4", DEFAULT_DISABLE_IPV4)) {
SetReachable(NET_IPV4, false);
}
//fprintf(stderr,"%s tik19\n", __FUNCTION__);
if (mapArgs.count("-allowlist")) {
BOOST_FOREACH(const std::string& net, mapMultiArgs["-allowlist"]) {

View File

@@ -50,6 +50,9 @@ extern int32_t HUSH_TESTNODE;
// Satoshi originally used 10 seconds(!), did they know something Peter Wuille didn't?
#define DUMP_ADDRESSES_INTERVAL 300
// Run asmap health check every 24hr by default
#define ASMAP_HEALTHCHECK_INTERVAL 24*60*60
// This is every 2 blocks, on avg, on HUSH3
#define DUMP_ZINDEX_INTERVAL 150
@@ -1648,6 +1651,30 @@ int64_t PoissonNextSend(int64_t now, int average_interval_seconds)
return now + (int64_t)(log1p(GetRand(1ULL << 48) * -0.0000000000000035527136788 /* -1/2^48 */) * average_interval_seconds * -1000000.0 + 0.5);
}
void ASMapHealthCheck() {
std::set<uint32_t> clearnet_asns{};
int unmapped_count{0};
LOCK(cs_vNodes);
for (const auto& pnode : vNodes) {
auto address = pnode->addr;
if(address.IsTor() || address.IsI2P() || address.IsCJDNS()) {
// These networks do not have ASNs, skip them
continue;
}
uint32_t asn = address.GetMappedAS(addrman.m_asmap);
if (asn == 0) {
++unmapped_count;
continue;
}
clearnet_asns.insert(asn);
}
LogPrintf("ASMap Health Check: %i clearnet peers are mapped to %i ASNs with %i peers being unmapped\n", vNodes.size(), clearnet_asns.size(), unmapped_count);
}
void ThreadOpenConnections()
{
// Connect to specific addresses
@@ -1753,7 +1780,7 @@ void ThreadOpenConnections()
int64_t nNow = GetTime();
int nTries = 0;
LogPrint("net", "Resolving addrman collisions\n");
LogPrint("net", "Resolving addrman collisions\n");
addrman.ResolveCollisions();
while (true) {
@@ -2378,10 +2405,14 @@ void StartNode(boost::thread_group& threadGroup, CScheduler& scheduler)
scheduler.scheduleEvery(&DumpZindexStats, DUMP_ZINDEX_INTERVAL);
}
// Dump network addresses
scheduler.scheduleEvery(&DumpAddresses, DUMP_ADDRESSES_INTERVAL);
// Look for ~/.hush/AC_NAME/plz_stop
scheduler.scheduleEvery(&CheckIfWeShouldStop, CHECK_PLZ_STOP_INTERVAL);
// Schedule ASMap Health check to run regularly
scheduler.scheduleEvery(&ASMapHealthCheck, ASMAP_HEALTHCHECK_INTERVAL);
// and schedule it to run once in 5 mins when we hopefully have peers connected
scheduler.scheduleFromNow(&ASMapHealthCheck, 300);
}
bool StopNode()

View File

@@ -85,6 +85,12 @@ static const unsigned int MAX_PROTOCOL_MESSAGE_LENGTH = (_MAX_BLOCK_SIZE + 24);
static const unsigned int MAX_SUBVERSION_LENGTH = 256;
/** -listen default */
static const bool DEFAULT_LISTEN = true;
/** -disableipv4 default */
static const bool DEFAULT_DISABLE_IPV4 = false;
/** -disableipv6 default */
static const bool DEFAULT_DISABLE_IPV6 = false;
/** The maximum number of entries in mapAskFor */
static const size_t MAPASKFOR_MAX_SZ = MAX_INV_SZ;
/** The maximum number of entries in setAskFor (larger due to getdata latency)*/

View File

@@ -1,5 +1,5 @@
// Copyright (c) 2012-2014 The Bitcoin Core developers
// Copyright (c) 2016-2024 The Hush developers
// Copyright (c) 2016-2025 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 = 1987427;
static const int PROTOCOL_VERSION = 1987428;
//! initial proto version, to be increased after version/verack negotiation
static const int INIT_PROTO_VERSION = 209;
//! In this version, 'getheaders' was introduced.

View File

@@ -6,6 +6,14 @@
## ./util/build-debian-package.sh # build amd64 package
## ./util/build-debian-package.sh aarch64 # build package for specific archiecture
# Check if running on Debian and exit if it is not
if grep -qi "Debian" /etc/os-release; then
:
else
echo -e "NOT RUNNING THIS SCRIPT ON DEBIAN! Try again with Debian." >&2
exit 1
fi
ARCH=${1:-amd64}
echo "Let There Be Hush Debian Packages"