Compare commits
10 Commits
f8136f5839
...
28007893d7
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
28007893d7 | ||
|
|
7e1b5701a6 | ||
|
|
4cbad44688 | ||
|
|
876c32ed1f | ||
|
|
f889ded55e | ||
|
|
07738d75ab | ||
|
|
04916cdf57 | ||
|
|
0d139e0bdc | ||
|
|
4c86d11b13 | ||
|
|
978d4d739b |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -28,6 +28,7 @@ build-aux/test-driver
|
||||
config.log
|
||||
config.status
|
||||
configure
|
||||
configure~
|
||||
libtool
|
||||
src/config/bitcoin-config.h
|
||||
src/config/bitcoin-config.h.in
|
||||
@@ -166,3 +167,4 @@ REGTEST_7776
|
||||
src/cc/librogue.so
|
||||
src/cc/games/prices
|
||||
src/cc/games/tetris
|
||||
release-linux/
|
||||
@@ -1,3 +1,31 @@
|
||||
hush (3.10.5) stable; urgency=medium
|
||||
|
||||
* DragonX is no longer supported by this codebase
|
||||
* DragonX devs have forked our code and we wish them the best
|
||||
* Find the latest place to download a DragonX full node via dragonx.is
|
||||
* Concurrent `z_sendmany` now works
|
||||
* A longstanding bug relating to run multiple `z_sendmany` operations at
|
||||
once has been fixed. You can now queue up many `z_sendmany` operations
|
||||
and they will succeed because they now understand how to avoid spending
|
||||
coins that another `z_sendmany` process is trying to spend.
|
||||
* Updated Autonomous System Map (asmap)
|
||||
* New RPC `z_listlockunspent`
|
||||
* Lists shielded notes (coins inside a zaddr) which are temporarily unspendable because an RPC process is currently trying to spend them.
|
||||
* If that operation succeeds, they will become spent. If it fails they will be unlocked and become spendable again.
|
||||
* New option to `z_shieldcoinbase` allows privately donating a percentage of coinbase funds during shielding
|
||||
* This new option defaults to OFF and allows CLI users to opt-in to donating between 0% and 10% of coinbase funds to developers
|
||||
* No GUI currently utilizes this but that feature is planned for SD
|
||||
* The donation has extremely good privacy:
|
||||
* It cannot be determined from public blockchain data if a donation is being made, as it takes the place of a Sietch output
|
||||
* It cannot be determined from public blockchain data the amount of the donation
|
||||
* Donations do not create new transactions, do not use additional blockspace and cannot be detected by anyone but the sender or reciever
|
||||
* New HAC option `ac_clearnet` can be used to disable clearnet networking for an entire blockchain instead of just a single node
|
||||
* Updated test framework and tests which allowed the fixing of the `z_sendmany` bug above
|
||||
* Faster compiling of RandomX internals
|
||||
* GMP dependency removed, as it is no longer needed
|
||||
* Hush is now compatible with GCC15 and now correctly supports customizing the compiler for a build via the CC env var
|
||||
* New HTML man pages are now available at doc/man/hushd.html and doc/man/hush-cli.html
|
||||
|
||||
hush (3.10.4) stable; urgency=medium
|
||||
|
||||
* Updated seed node list
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.13.
|
||||
.TH HUSH-CLI "1" "July 2025" "hush-cli v3.10.4" "User Commands"
|
||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3.
|
||||
.TH HUSH-CLI "1" "March 2026" "hush-cli v3.10.5" "User Commands"
|
||||
.SH NAME
|
||||
hush-cli \- manual page for hush-cli v3.10.4
|
||||
hush-cli \- manual page for hush-cli v3.10.5
|
||||
.SH DESCRIPTION
|
||||
Hush RPC client version v3.10.4\-7e63e2f01\-dirty
|
||||
Hush RPC client version v3.10.5\-04916cdf5
|
||||
.PP
|
||||
In order to ensure you are adequately protecting your privacy when using Hush,
|
||||
please see <https://hush.is/security/>.
|
||||
@@ -75,7 +75,7 @@ Read extra arguments from standard input, one per line until EOF/Ctrl\-D
|
||||
In order to ensure you are adequately protecting your privacy when using Hush,
|
||||
please see <https://hush.is/security/>.
|
||||
|
||||
Copyright (C) 2016-2025 Duke Leto and The Hush Developers
|
||||
Copyright (C) 2016-2026 Duke Leto and The Hush Developers
|
||||
|
||||
Copyright (C) 2016-2020 jl777 and SuperNET developers
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.13.
|
||||
.TH HUSH-TX "1" "July 2025" "hush-tx v3.10.4" "User Commands"
|
||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3.
|
||||
.TH HUSH-TX "1" "March 2026" "hush-tx v3.10.5" "User Commands"
|
||||
.SH NAME
|
||||
hush-tx \- manual page for hush-tx v3.10.4
|
||||
hush-tx \- manual page for hush-tx v3.10.5
|
||||
.SH DESCRIPTION
|
||||
hush\-tx utility version v3.10.4\-7e63e2f01\-dirty
|
||||
hush\-tx utility version v3.10.5\-04916cdf5
|
||||
.SS "Usage:"
|
||||
.TP
|
||||
hush\-tx [options] <hex\-tx> [commands]
|
||||
@@ -89,7 +89,7 @@ Set register NAME to given JSON\-STRING
|
||||
In order to ensure you are adequately protecting your privacy when using Hush,
|
||||
please see <https://hush.is/security/>.
|
||||
|
||||
Copyright (C) 2016-2025 Duke Leto and The Hush Developers
|
||||
Copyright (C) 2016-2026 Duke Leto and The Hush Developers
|
||||
|
||||
Copyright (C) 2016-2020 jl777 and SuperNET developers
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.13.
|
||||
.TH HUSHD "1" "July 2025" "hushd v3.10.4" "User Commands"
|
||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3.
|
||||
.TH HUSHD "1" "March 2026" "hushd v3.10.5" "User Commands"
|
||||
.SH NAME
|
||||
hushd \- manual page for hushd v3.10.4
|
||||
hushd \- manual page for hushd v3.10.5
|
||||
.SH DESCRIPTION
|
||||
Hush Daemon version v3.10.4\-7e63e2f01\-dirty
|
||||
Hush Daemon version v3.10.5\-04916cdf5
|
||||
.PP
|
||||
In order to ensure you are adequately protecting your privacy when using Hush,
|
||||
please see <https://hush.is/security/>.
|
||||
@@ -78,7 +78,7 @@ applied)
|
||||
.HP
|
||||
\fB\-par=\fR<n>
|
||||
.IP
|
||||
Set the number of script verification threads (\fB\-8\fR to 16, 0 = auto, <0 =
|
||||
Set the number of script verification threads (\fB\-32\fR to 16, 0 = auto, <0 =
|
||||
leave that many cores free, default: 0)
|
||||
.HP
|
||||
\fB\-pid=\fR<file>
|
||||
@@ -686,6 +686,12 @@ OP_RETURN minimum fee per tx, regardless of tx size, default is 1 coin
|
||||
.IP
|
||||
CODA integration
|
||||
.HP
|
||||
\fB\-ac_clearnet\fR
|
||||
.IP
|
||||
Enable or disable clearnet connections for the entire blockchain.
|
||||
Setting to 0 will disable clearnet and use sane defaults for
|
||||
Tor/i2p and require all nodes to do the same (default: 1)
|
||||
.HP
|
||||
\fB\-ac_decay\fR
|
||||
.IP
|
||||
Percentage of block reward decrease at each halving
|
||||
@@ -759,7 +765,7 @@ Enforce transaction\-rate limit, default 0
|
||||
In order to ensure you are adequately protecting your privacy when using Hush,
|
||||
please see <https://hush.is/security/>.
|
||||
|
||||
Copyright (C) 2016-2025 Duke Leto and The Hush Developers
|
||||
Copyright (C) 2016-2026 Duke Leto and The Hush Developers
|
||||
|
||||
Copyright (C) 2016-2020 jl777 and SuperNET developers
|
||||
|
||||
|
||||
@@ -71,11 +71,11 @@ Install deps on Linux:
|
||||
- To make a pre-release "beta" you can modify `CLIENT_VERSION_BUILD` but that is rarely done in Hush world.
|
||||
- A `CLIENT_VERSION_BUILD` of 50 means "actual non-beta release"
|
||||
- Make sure to keep the values in configure.ac and src/clientversion.h the same. The variables are prefixed wth an underscore in configure.ac
|
||||
- Run `make manpages`, commit + push results
|
||||
- hushd must be running so the script can automatically get the correct version number
|
||||
- There is a hack in the script where you can hardcode a version number if hushd isn't running.
|
||||
- Comment out the HUSHVER line and uncomment the line above it with a hardcoded version number
|
||||
- Run `./util/gen-manpages.sh`, commit + push results
|
||||
- There is a hack in the script where you can hardcode a version number if hushd isn't compiled on this machine
|
||||
- Comment out the HUSHVER line and uncomment the line above it with a hardcoded version number
|
||||
- PROTIP: Man page creation must be done after updating the version number and recompiling and before Debian package creation
|
||||
- TODO: How to regenerate html man pages?
|
||||
- Update checkpoints in src/chainparams.cpp via util/checkpoints.pl
|
||||
- Run "./util/checkpoints.pl help" to get example usage
|
||||
- hushd must be running to run this script, since it uses hush-cli to get the data
|
||||
@@ -97,7 +97,6 @@ Install deps on Linux:
|
||||
- They only provide limited security, because they talk about the past, not future block heights.
|
||||
- Try to generate checkpoints as close to the release as possible, so you can have a recent block height be protected.
|
||||
- For instance, don't update checkpoints and then do a release a month later. You can always update checkpoint data again or multiple times
|
||||
- Update copyright years if applicable. Example: `./util/update-copyrights.h 2022 2023`
|
||||
- Update doc/relnotes/README.md
|
||||
- To get the stats of file changes: `git diff --stat master...dev`
|
||||
- Do a fresh clone and fresh sync with new checkpoints
|
||||
|
||||
@@ -10,24 +10,35 @@ 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. They also use all your "private" repos to train their AI.
|
||||
|
||||
# Hush 3.10.5 ""
|
||||
# Hush 3.10.5 "Atelic Alpaca"
|
||||
|
||||
This is an OPTIONAL but RECOMMENDED upgrade.
|
||||
|
||||
* DragonX is no longer supported by this codebase
|
||||
* DragonX devs have forked our code and we wish them the best
|
||||
* Find the latest place to download a DragonX full node via dragonx.is
|
||||
* Concurrent `z_sendmany` now works
|
||||
* A longstanding bug relating to run multiple `z_sendmany` operations at
|
||||
once has been fixed. You can now queue up many `z_sendmany` operations
|
||||
and they will succeed because they now understand how to avoid spending
|
||||
coins that another `z_sendmany` process is trying to spend.
|
||||
* Updated Autonomous System Map (asmap)
|
||||
* New RPC `z_listlockunspent`
|
||||
* Lists shielded notes (coins inside a zaddr) which are temporarily unspendable because an RPC process is currently trying to spend them.
|
||||
* If that operation succeeds, they will become spent. If it fails they will be unlocked and become spendable again.
|
||||
* Fixed DragonX checkpoints
|
||||
* Hush checkpoints were mistakenly listed as checkpoints in the 3.10.4
|
||||
release, which caused some nodes to be unable to sync.
|
||||
* This release fixes this issue.
|
||||
* New option to `z_shieldcoinbase` allows privately donating a percentage of coinbase funds during shielding
|
||||
* This new option defaults to OFF and allows CLI users to opt-in to donating between 0% and 10% of coinbase funds to developers
|
||||
* No GUI currently utilizes this but that feature is planned for SD
|
||||
* The donation has extremely good privacy:
|
||||
* It cannot be determined from public blockchain data if a donation is being made, as it takes the place of a Sietch output
|
||||
* It cannot be determined from public blockchain data the amount of the donation
|
||||
* Donations do not create new transactions, do not use additional blockspace and cannot be detected by anyone but the sender or reciever
|
||||
* New HAC option `ac_clearnet` can be used to disable clearnet networking for an entire blockchain instead of just a single node
|
||||
* Updated test framework and tests which allowed the fixing of the `z_sendmany` bug above
|
||||
* Faster compiling of RandomX internals
|
||||
* GMP dependency removed, as it is no longer needed
|
||||
* Hush is now compatible with GCC15 and now correctly supports customizing the compiler for a build via the CC env var
|
||||
* New HTML man pages are now available at doc/man/hushd.html and doc/man/hush-cli.html
|
||||
|
||||
# Hush 3.10.4 "Hazy Hākuturi"
|
||||
|
||||
|
||||
@@ -1693,6 +1693,11 @@ int32_t hush_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height)
|
||||
fprintf(stderr,"hush_checkPOW slowflag.%d ht.%d CheckEquihashSolution failed\n",slowflag,height);
|
||||
return(-1);
|
||||
}
|
||||
if ( !CheckRandomXSolution(pblock, height) )
|
||||
{
|
||||
fprintf(stderr,"hush_checkPOW slowflag.%d ht.%d CheckRandomXSolution failed\n",slowflag,height);
|
||||
return(-1);
|
||||
}
|
||||
hash = pblock->GetHash();
|
||||
bnTarget.SetCompact(pblock->nBits,&fNegative,&fOverflow);
|
||||
bhash = UintToArith256(hash);
|
||||
|
||||
@@ -568,6 +568,7 @@ extern uint64_t ASSETCHAINS_SUPPLY, ASSETCHAINS_FOUNDERS_REWARD;
|
||||
extern int32_t ASSETCHAINS_LWMAPOS, ASSETCHAINS_SAPLING, ASSETCHAINS_OVERWINTER,ASSETCHAINS_BLOCKTIME;
|
||||
extern uint64_t ASSETCHAINS_TIMELOCKGTE;
|
||||
extern uint32_t ASSETCHAINS_ALGO,ASSETCHAINS_EQUIHASH,ASSETCHAINS_RANDOMX, HUSH_INITDONE;
|
||||
extern int32_t ASSETCHAINS_RANDOMX_VALIDATION;
|
||||
extern int32_t HUSH_MININGTHREADS,HUSH_LONGESTCHAIN,ASSETCHAINS_SEED,IS_HUSH_NOTARY,USE_EXTERNAL_PUBKEY,HUSH_CHOSEN_ONE,HUSH_ON_DEMAND,HUSH_PASSPORT_INITDONE,ASSETCHAINS_STAKED,HUSH_NSPV;
|
||||
extern uint64_t ASSETCHAINS_COMMISSION, ASSETCHAINS_LASTERA,ASSETCHAINS_CBOPRET;
|
||||
extern uint64_t ASSETCHAINS_REWARD[ASSETCHAINS_MAX_ERAS+1], ASSETCHAINS_NOTARY_PAY[ASSETCHAINS_MAX_ERAS+1], ASSETCHAINS_TIMELOCKGTE, ASSETCHAINS_NONCEMASK[],ASSETCHAINS_NK[2];
|
||||
|
||||
@@ -93,6 +93,7 @@ uint64_t ASSETCHAINS_NONCEMASK[] = {0xffff};
|
||||
uint32_t ASSETCHAINS_NONCESHIFT[] = {32};
|
||||
uint32_t ASSETCHAINS_HASHESPERROUND[] = {1};
|
||||
uint32_t ASSETCHAINS_ALGO = _ASSETCHAINS_EQUIHASH;
|
||||
int32_t ASSETCHAINS_RANDOMX_VALIDATION = -1; // activation height for RandomX validation (-1 = disabled)
|
||||
// min diff returned from GetNextWorkRequired needs to be added here for each algo, so they can work with ac_staked.
|
||||
uint32_t ASSETCHAINS_MINDIFF[] = {537857807};
|
||||
int32_t ASSETCHAINS_LWMAPOS = 0; // percentage of blocks should be PoS
|
||||
|
||||
@@ -1902,6 +1902,18 @@ void hush_args(char *argv0)
|
||||
strncpy(SMART_CHAIN_SYMBOL,name.c_str(),sizeof(SMART_CHAIN_SYMBOL)-1);
|
||||
const bool ishush3 = strncmp(SMART_CHAIN_SYMBOL, "HUSH3",5) == 0 ? true : false;
|
||||
|
||||
// Set RandomX validation activation height per chain
|
||||
if (ASSETCHAINS_ALGO == ASSETCHAINS_RANDOMX) {
|
||||
if (strncmp(SMART_CHAIN_SYMBOL, "DRAGONX", 7) == 0) {
|
||||
ASSETCHAINS_RANDOMX_VALIDATION = 2838976; // TBD: set to coordinated upgrade height
|
||||
} else if (strncmp(SMART_CHAIN_SYMBOL, "TUMIN", 5) == 0) {
|
||||
ASSETCHAINS_RANDOMX_VALIDATION = 1200; // TBD: set to coordinated upgrade height
|
||||
} else {
|
||||
ASSETCHAINS_RANDOMX_VALIDATION = 1; // all other RandomX HACs: enforce from height 1
|
||||
}
|
||||
printf("ASSETCHAINS_RANDOMX_VALIDATION set to %d for %s\n", ASSETCHAINS_RANDOMX_VALIDATION, SMART_CHAIN_SYMBOL);
|
||||
}
|
||||
|
||||
ASSETCHAINS_LASTERA = GetArg("-ac_eras", 1);
|
||||
if(ishush3) {
|
||||
ASSETCHAINS_LASTERA = 3;
|
||||
|
||||
@@ -4993,6 +4993,8 @@ bool CheckBlockHeader(int32_t *futureblockp,int32_t height,CBlockIndex *pindex,
|
||||
{
|
||||
if ( !CheckEquihashSolution(&blockhdr, Params()) )
|
||||
return state.DoS(100, error("CheckBlockHeader(): Equihash solution invalid"),REJECT_INVALID, "invalid-solution");
|
||||
if ( !CheckRandomXSolution(&blockhdr, height) )
|
||||
return state.DoS(100, error("CheckBlockHeader(): RandomX solution invalid"),REJECT_INVALID, "invalid-randomx-solution");
|
||||
}
|
||||
// Check proof of work matches claimed amount
|
||||
/*hush_index2pubkey33(pubkey33,pindex,height);
|
||||
|
||||
136
src/pow.cpp
136
src/pow.cpp
@@ -28,6 +28,8 @@
|
||||
#include "uint256.h"
|
||||
#include "util.h"
|
||||
#include "sodium.h"
|
||||
#include "RandomX/src/randomx.h"
|
||||
#include <mutex>
|
||||
|
||||
#ifdef ENABLE_RUST
|
||||
#include "librustzcash.h"
|
||||
@@ -683,6 +685,137 @@ bool CheckEquihashSolution(const CBlockHeader *pblock, const CChainParams& param
|
||||
return true;
|
||||
}
|
||||
|
||||
// Static objects for CheckRandomXSolution
|
||||
static std::mutex cs_randomx_validator;
|
||||
static randomx_cache *s_rxCache = nullptr;
|
||||
static randomx_vm *s_rxVM = nullptr;
|
||||
static std::string s_rxCurrentKey; // tracks current key to avoid re-init
|
||||
|
||||
// Thread-local flag: skip CheckRandomXSolution when the miner is validating its own block
|
||||
// The miner already computed the correct RandomX hash — re-verifying with a separate
|
||||
// cache+VM would allocate ~256MB extra memory and can trigger the OOM killer.
|
||||
thread_local bool fSkipRandomXValidation = false;
|
||||
|
||||
void SetSkipRandomXValidation(bool skip) { fSkipRandomXValidation = skip; }
|
||||
|
||||
CBlockIndex *hush_chainactive(int32_t height);
|
||||
|
||||
bool CheckRandomXSolution(const CBlockHeader *pblock, int32_t height)
|
||||
{
|
||||
// Only applies to RandomX chains
|
||||
if (ASSETCHAINS_ALGO != ASSETCHAINS_RANDOMX)
|
||||
return true;
|
||||
|
||||
// Disabled if activation height is negative
|
||||
if (ASSETCHAINS_RANDOMX_VALIDATION < 0)
|
||||
return true;
|
||||
|
||||
// Not yet at activation height
|
||||
if (height < ASSETCHAINS_RANDOMX_VALIDATION)
|
||||
return true;
|
||||
|
||||
// Do not affect initial block loading
|
||||
extern int32_t HUSH_LOADINGBLOCKS;
|
||||
if (HUSH_LOADINGBLOCKS != 0)
|
||||
return true;
|
||||
|
||||
// Skip when miner is validating its own block via TestBlockValidity
|
||||
if (fSkipRandomXValidation)
|
||||
return true;
|
||||
|
||||
// nSolution must be exactly RANDOMX_HASH_SIZE (32) bytes
|
||||
if (pblock->nSolution.size() != RANDOMX_HASH_SIZE) {
|
||||
return error("CheckRandomXSolution(): nSolution size %u != expected %d at height %d",
|
||||
pblock->nSolution.size(), RANDOMX_HASH_SIZE, height);
|
||||
}
|
||||
|
||||
static int randomxInterval = GetRandomXInterval();
|
||||
static int randomxBlockLag = GetRandomXBlockLag();
|
||||
|
||||
// Determine the correct RandomX key for this height
|
||||
char initialKey[82];
|
||||
snprintf(initialKey, 81, "%08x%s%08x", ASSETCHAINS_MAGIC, SMART_CHAIN_SYMBOL, ASSETCHAINS_RPCPORT);
|
||||
|
||||
std::string rxKey;
|
||||
if (height < randomxInterval + randomxBlockLag) {
|
||||
// Use initial key derived from chain params
|
||||
rxKey = std::string(initialKey, strlen(initialKey));
|
||||
} else {
|
||||
// Use block hash at the key height
|
||||
int keyHeight = ((height - randomxBlockLag) / randomxInterval) * randomxInterval;
|
||||
CBlockIndex *pKeyIndex = hush_chainactive(keyHeight);
|
||||
if (pKeyIndex == nullptr) {
|
||||
return error("CheckRandomXSolution(): cannot get block index at key height %d for block %d", keyHeight, height);
|
||||
}
|
||||
uint256 blockKey = pKeyIndex->GetBlockHash();
|
||||
rxKey = std::string((const char*)&blockKey, sizeof(blockKey));
|
||||
}
|
||||
|
||||
// Serialize the block header without nSolution (but with nNonce) as RandomX input
|
||||
CRandomXInput rxInput(*pblock);
|
||||
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
|
||||
ss << rxInput;
|
||||
|
||||
char computedHash[RANDOMX_HASH_SIZE];
|
||||
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(cs_randomx_validator);
|
||||
|
||||
// Initialize cache + VM if needed, or re-init if key changed
|
||||
if (s_rxCache == nullptr) {
|
||||
randomx_flags flags = randomx_get_flags();
|
||||
s_rxCache = randomx_alloc_cache(flags);
|
||||
if (s_rxCache == nullptr) {
|
||||
return error("CheckRandomXSolution(): failed to allocate RandomX cache");
|
||||
}
|
||||
randomx_init_cache(s_rxCache, rxKey.data(), rxKey.size());
|
||||
s_rxCurrentKey = rxKey;
|
||||
s_rxVM = randomx_create_vm(flags, s_rxCache, nullptr);
|
||||
if (s_rxVM == nullptr) {
|
||||
randomx_release_cache(s_rxCache);
|
||||
s_rxCache = nullptr;
|
||||
return error("CheckRandomXSolution(): failed to create RandomX VM");
|
||||
}
|
||||
} else if (s_rxCurrentKey != rxKey) {
|
||||
randomx_init_cache(s_rxCache, rxKey.data(), rxKey.size());
|
||||
s_rxCurrentKey = rxKey;
|
||||
randomx_vm_set_cache(s_rxVM, s_rxCache);
|
||||
}
|
||||
|
||||
randomx_calculate_hash(s_rxVM, &ss[0], ss.size(), computedHash);
|
||||
}
|
||||
|
||||
// Compare computed hash against nSolution
|
||||
if (memcmp(computedHash, pblock->nSolution.data(), RANDOMX_HASH_SIZE) != 0) {
|
||||
// Debug: dump both hashes for diagnosis
|
||||
std::string computedHex, solutionHex;
|
||||
for (int i = 0; i < RANDOMX_HASH_SIZE; i++) {
|
||||
char buf[4];
|
||||
snprintf(buf, sizeof(buf), "%02x", (uint8_t)computedHash[i]);
|
||||
computedHex += buf;
|
||||
snprintf(buf, sizeof(buf), "%02x", pblock->nSolution[i]);
|
||||
solutionHex += buf;
|
||||
}
|
||||
fprintf(stderr, "CheckRandomXSolution(): HASH MISMATCH at height %d\n", height);
|
||||
fprintf(stderr, " computed : %s\n", computedHex.c_str());
|
||||
fprintf(stderr, " nSolution: %s\n", solutionHex.c_str());
|
||||
fprintf(stderr, " rxKey size=%lu, input size=%lu, nNonce=%s\n",
|
||||
rxKey.size(), ss.size(), pblock->nNonce.ToString().c_str());
|
||||
fprintf(stderr, " nSolution.size()=%lu, RANDOMX_HASH_SIZE=%d\n",
|
||||
pblock->nSolution.size(), RANDOMX_HASH_SIZE);
|
||||
// Also log to debug.log
|
||||
LogPrintf("CheckRandomXSolution(): HASH MISMATCH at height %d\n", height);
|
||||
LogPrintf(" computed : %s\n", computedHex);
|
||||
LogPrintf(" nSolution: %s\n", solutionHex);
|
||||
LogPrintf(" rxKey size=%lu, input size=%lu, nNonce=%s\n",
|
||||
rxKey.size(), ss.size(), pblock->nNonce.ToString());
|
||||
return false;
|
||||
}
|
||||
|
||||
LogPrint("randomx", "CheckRandomXSolution(): valid at height %d\n", height);
|
||||
return true;
|
||||
}
|
||||
|
||||
int32_t hush_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33,uint32_t timestamp);
|
||||
int32_t hush_currentheight();
|
||||
void hush_index2pubkey33(uint8_t *pubkey33,CBlockIndex *pindex,int32_t height);
|
||||
@@ -729,6 +862,8 @@ bool CheckProofOfWork(const CBlockHeader &blkHeader, uint8_t *pubkey33, int32_t
|
||||
if ( HUSH_LOADINGBLOCKS != 0 )
|
||||
return true;
|
||||
|
||||
if ( SMART_CHAIN_SYMBOL[0] != 0 || height > 792000 )
|
||||
{
|
||||
if ( Params().NetworkIDString() != "regtest" )
|
||||
{
|
||||
for (i=31; i>=0; i--)
|
||||
@@ -745,6 +880,7 @@ bool CheckProofOfWork(const CBlockHeader &blkHeader, uint8_t *pubkey33, int32_t
|
||||
fprintf(stderr," <- origpubkey\n");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/*for (i=31; i>=0; i--)
|
||||
fprintf(stderr,"%02x",((uint8_t *)&hash)[i]);
|
||||
|
||||
12
src/pow.h
12
src/pow.h
@@ -38,6 +38,18 @@ unsigned int CalculateNextWorkRequired(arith_uint256 bnAvg,
|
||||
/** Check whether the Equihash solution in a block header is valid */
|
||||
bool CheckEquihashSolution(const CBlockHeader *pblock, const CChainParams&);
|
||||
|
||||
/** Check whether a block header contains a valid RandomX solution */
|
||||
bool CheckRandomXSolution(const CBlockHeader *pblock, int32_t height);
|
||||
|
||||
/** Set thread-local flag to skip RandomX validation (used by miner during TestBlockValidity) */
|
||||
void SetSkipRandomXValidation(bool skip);
|
||||
|
||||
/** Return the RandomX key rotation interval in blocks */
|
||||
int GetRandomXInterval();
|
||||
|
||||
/** Return the RandomX key change lag in blocks */
|
||||
int GetRandomXBlockLag();
|
||||
|
||||
/** Check whether a block hash satisfies the proof-of-work requirement specified by nBits */
|
||||
bool CheckProofOfWork(const CBlockHeader &blkHeader, uint8_t *pubkey33, int32_t height, const Consensus::Params& params);
|
||||
CChainPower GetBlockProof(const CBlockIndex& block);
|
||||
|
||||
@@ -237,6 +237,33 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Custom serializer for CBlockHeader that includes nNonce but omits nSolution,
|
||||
* for use as deterministic input to RandomX hashing.
|
||||
*/
|
||||
class CRandomXInput : private CBlockHeader
|
||||
{
|
||||
public:
|
||||
CRandomXInput(const CBlockHeader &header)
|
||||
{
|
||||
CBlockHeader::SetNull();
|
||||
*((CBlockHeader*)this) = header;
|
||||
}
|
||||
|
||||
ADD_SERIALIZE_METHODS;
|
||||
|
||||
template <typename Stream, typename Operation>
|
||||
inline void SerializationOp(Stream& s, Operation ser_action) {
|
||||
READWRITE(this->nVersion);
|
||||
READWRITE(hashPrevBlock);
|
||||
READWRITE(hashMerkleRoot);
|
||||
READWRITE(hashFinalSaplingRoot);
|
||||
READWRITE(nTime);
|
||||
READWRITE(nBits);
|
||||
READWRITE(nNonce);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/** Describes a place in the block chain to another node such that if the
|
||||
* other node doesn't have the same branch, it can find a recent common trunk.
|
||||
|
||||
@@ -14,7 +14,7 @@ HUSHTX=${HUSHTX:-$SRCDIR/hush-tx}
|
||||
# Check if help2man is installed & if not then display error to user and exit
|
||||
[ ! -x "$(command -v help2man)" ] && echo "help2man could not be found" && echo "Please install from your Linux package manager and try again" && echo "On Debian-based systems you can do: apt-get install help2man" && exit 1
|
||||
|
||||
# use this if hushd is not running
|
||||
# use this if hushd is not compiled
|
||||
#HUSHVER="v3.6.2"
|
||||
HUSHVER=$(./src/hushd --version|head -n1|cut -d' ' -f4|cut -d- -f1)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user