hygiene: Phase 3 follow-up — sweep commented-out debug cruft
Remove ~116 commented-out debug/dead-code lines the audit flagged as noise (findings F6/F7/F15/F22): the Komodo "%s tikN" step-tracer comments and other commented-out fprintf/printf/LogPrintf/std::cerr calls threaded through AppInit2 (init.cpp), CreateNewBlock and the miner loops (miner.cpp), plus a few commented-out dead-code fragments (sendmany SetLockTime/nLockTime, the CCtx CC_vinselect random-pick block and AddNormalinputsLocal remote-mypk redirect, miner adaptive-PoW assignments). Comments only — no compiled behavior changes; the tree builds clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -160,7 +160,6 @@ bool hush_appendACscriptpub();
|
||||
|
||||
CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32_t gpucount, bool isStake)
|
||||
{
|
||||
//fprintf(stderr,"%s\n", __func__);
|
||||
CScript scriptPubKeyIn(_scriptPubKeyIn);
|
||||
|
||||
CPubKey pk;
|
||||
@@ -179,12 +178,10 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
|
||||
uint32_t blocktime; const CChainParams& chainparams = Params();
|
||||
bool fNotarizationBlock = false; std::vector<int8_t> NotarizationNotaries;
|
||||
|
||||
//fprintf(stderr,"%s: create new block with pubkey=%s\n", __func__, HexStr(pk).c_str());
|
||||
// Create new block
|
||||
if ( gpucount < 0 )
|
||||
gpucount = HUSH_MAXGPUCOUNT;
|
||||
std::unique_ptr<CBlockTemplate> pblocktemplate(new CBlockTemplate());
|
||||
//fprintf(stderr,"%s: created new block template\n", __func__);
|
||||
if(!pblocktemplate.get())
|
||||
{
|
||||
fprintf(stderr,"%s: pblocktemplate.get() failure\n", __func__);
|
||||
@@ -200,7 +197,6 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
|
||||
pblock->vtx.push_back(CTransaction());
|
||||
pblocktemplate->vTxFees.push_back(-1); // updated at end
|
||||
pblocktemplate->vTxSigOps.push_back(-1); // updated at end
|
||||
//fprintf(stderr,"%s: added dummy coinbase\n", __func__);
|
||||
|
||||
// Largest block you're willing to create:
|
||||
unsigned int nBlockMaxSize = GetArg("-blockmaxsize", MAX_BLOCK_SIZE(1)); // MAX_BLOCK_SIZE(chainActive.LastTip()->GetHeight()+1));
|
||||
@@ -217,7 +213,6 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
|
||||
// until there are no more or the block reaches this size:
|
||||
const unsigned int nBlockMinSize = std::min(nBlockMaxSize, (unsigned int) GetArg("-blockminsize", DEFAULT_BLOCK_MIN_SIZE));
|
||||
// nBlockMinSize = std::min(nBlockMaxSize, nBlockMinSize);
|
||||
//fprintf(stderr,"%s: nBlockMaxSize=%u, nBlockPrioritySize=%u, nBlockMinSize=%u\n", __func__, nBlockMaxSize, nBlockPrioritySize, nBlockMinSize);
|
||||
|
||||
|
||||
// Collect memory pool transactions into the block
|
||||
@@ -243,7 +238,6 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
|
||||
const int64_t nMedianTimePast = pindexPrev->GetMedianTimePast();
|
||||
uint32_t proposedTime = GetTime();
|
||||
|
||||
//fprintf(stderr,"%s: nHeight=%d, consensusBranchId=%u, proposedTime=%u\n", __func__, nHeight, consensusBranchId, proposedTime);
|
||||
|
||||
if (proposedTime == nMedianTimePast)
|
||||
{
|
||||
@@ -282,7 +276,6 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
|
||||
vector<TxPriority> vecPriority;
|
||||
vecPriority.reserve(mempool.mapTx.size() + 1);
|
||||
|
||||
//fprintf(stderr,"%s: going to add txs from mempool\n", __func__);
|
||||
// now add transactions from the mempool
|
||||
int32_t Notarizations = 0; uint64_t txvalue;
|
||||
uint32_t large_zins = 0; // number of ztxs with large number of inputs in block
|
||||
@@ -392,7 +385,6 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
|
||||
|
||||
// Priority is sum(valuein * age) / modified_txsize
|
||||
unsigned int nTxSize = ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION);
|
||||
// fprintf(stderr,"%s: computing priority with nTxSize=%u\n", __func__, nTxSize);
|
||||
dPriority = tx.ComputePriority(dPriority, nTxSize);
|
||||
|
||||
uint256 hash = tx.GetHash();
|
||||
@@ -423,7 +415,6 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
|
||||
NotarizationNotaries = TMP_NotarizationNotaries;
|
||||
dPriority = 1e16;
|
||||
fNotarizationBlock = true;
|
||||
//fprintf(stderr, "Notarization %s set to maximum priority\n",hash.ToString().c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -438,7 +429,6 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
|
||||
vecPriority.push_back(TxPriority(dPriority, feeRate, &(mi->GetTx())));
|
||||
}
|
||||
}
|
||||
// fprintf(stderr,"%s: done adding txs from mempool\n", __func__);
|
||||
|
||||
// Collect transactions into block
|
||||
int64_t interest;
|
||||
@@ -450,7 +440,6 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
|
||||
TxPriorityCompare comparer(fSortedByFee);
|
||||
std::make_heap(vecPriority.begin(), vecPriority.end(), comparer);
|
||||
|
||||
// fprintf(stderr,"%s: compared txs with fSortedByFee=%d\n", __func__, fSortedByFee);
|
||||
|
||||
while (!vecPriority.empty()) {
|
||||
// Take highest priority transaction off the priority queue:
|
||||
@@ -458,10 +447,8 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
|
||||
CFeeRate feeRate = vecPriority.front().get<1>();
|
||||
const CTransaction& tx = *(vecPriority.front().get<2>());
|
||||
|
||||
// fprintf(stderr,"%s: grabbed first tx from priority queue\n", __func__);
|
||||
|
||||
std::pop_heap(vecPriority.begin(), vecPriority.end(), comparer);
|
||||
// fprintf(stderr,"%s: compared first tx from priority queue\n", __func__);
|
||||
vecPriority.pop_back();
|
||||
|
||||
if(tx.vShieldedSpend.size() >= LARGE_ZINS_THRESHOLD && large_zins >= LARGE_ZINS_MAX) {
|
||||
@@ -478,7 +465,6 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
|
||||
|
||||
// Size limits
|
||||
unsigned int nTxSize = ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION);
|
||||
// fprintf(stderr,"%s: nTxSize = %u\n", __func__, nTxSize);
|
||||
|
||||
|
||||
if (nBlockSize + nTxSize >= nBlockMaxSize-512) // room for extra autotx
|
||||
@@ -491,11 +477,9 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
|
||||
unsigned int nTxSigOps = GetLegacySigOpCount(tx);
|
||||
if (nBlockSigOps + nTxSigOps >= MAX_BLOCK_SIGOPS-1)
|
||||
{
|
||||
//fprintf(stderr,"A nBlockSigOps %d + %d nTxSigOps >= %d MAX_BLOCK_SIGOPS-1\n",(int32_t)nBlockSigOps,(int32_t)nTxSigOps,(int32_t)MAX_BLOCK_SIGOPS);
|
||||
continue;
|
||||
}
|
||||
|
||||
// fprintf(stderr,"%s: looking to see if we need to skip any fee=0 txs\n", __func__);
|
||||
|
||||
// Skip free transactions if we're past the minimum block size:
|
||||
const uint256& hash = tx.GetHash();
|
||||
@@ -518,7 +502,6 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
|
||||
|
||||
if (!view.HaveInputs(tx))
|
||||
{
|
||||
//fprintf(stderr,"dont have inputs\n");
|
||||
continue;
|
||||
}
|
||||
CAmount nTxFees = view.GetValueIn(chainActive.LastTip()->GetHeight(),&interest,tx,chainActive.LastTip()->nTime)-tx.GetValueOut();
|
||||
@@ -560,7 +543,6 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
|
||||
nTxSigOps += GetP2SHSigOpCount(tx, view);
|
||||
if (nBlockSigOps + nTxSigOps >= MAX_BLOCK_SIGOPS-1)
|
||||
{
|
||||
//fprintf(stderr,"B nBlockSigOps %d + %d nTxSigOps >= %d MAX_BLOCK_SIGOPS-1\n",(int32_t)nBlockSigOps,(int32_t)nTxSigOps,(int32_t)MAX_BLOCK_SIGOPS);
|
||||
continue;
|
||||
}
|
||||
// Note that flags: we don't want to set mempool/IsStandard()
|
||||
@@ -625,13 +607,11 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
|
||||
|
||||
nLastBlockTx = nBlockTx;
|
||||
nLastBlockSize = nBlockSize;
|
||||
// fprintf(stderr,"%s: nLastBlockTx=%lu , nLastBlockSize=%lu\n", __func__, nLastBlockTx, nLastBlockSize);
|
||||
|
||||
if ( ASSETCHAINS_ADAPTIVEPOW <= 0 )
|
||||
blocktime = 1 + std::max(pindexPrev->GetMedianTimePast()+1, GetTime());
|
||||
else blocktime = 1 + std::max((int64_t)(pindexPrev->nTime+1), GetTime());
|
||||
//pblock->nTime = blocktime + 1;
|
||||
// fprintf(stderr,"%s: calling GetNextWorkRequired\n", __func__);
|
||||
pblock->nBits = GetNextWorkRequired(pindexPrev, pblock, Params().GetConsensus());
|
||||
|
||||
LogPrintf("CreateNewBlock(): total size %u blocktime.%u nBits.%08x\n", nBlockSize,blocktime,pblock->nBits);
|
||||
@@ -645,7 +625,6 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
|
||||
txNew.vout.resize(1);
|
||||
txNew.vout[0].scriptPubKey = scriptPubKeyIn;
|
||||
txNew.vout[0].nValue = GetBlockSubsidy(nHeight,consensusParams) + nFees;
|
||||
// fprintf(stderr,"%s: mine ht.%d with %.8f\n",__func__,nHeight,(double)txNew.vout[0].nValue/COIN);
|
||||
txNew.nExpiryHeight = 0;
|
||||
if ( ASSETCHAINS_ADAPTIVEPOW <= 0 )
|
||||
txNew.nLockTime = std::max(pindexPrev->GetMedianTimePast()+1, GetTime());
|
||||
@@ -670,7 +649,6 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
|
||||
fprintf(stderr, "appended ccopreturn to assetchains_scriptpub.%s\n", assetchains_scriptpub.c_str());
|
||||
didinit = true;
|
||||
}
|
||||
//fprintf(stderr,"mine to -ac_script\n");
|
||||
//txNew.vout[1].scriptPubKey = CScript() << ParseHex();
|
||||
int32_t len = strlen(assetchains_scriptpub.c_str());
|
||||
len >>= 1;
|
||||
@@ -684,12 +662,9 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
|
||||
for (i=0; i<33; i++)
|
||||
{
|
||||
ptr[i+1] = ASSETCHAINS_OVERRIDE_PUBKEY33[i];
|
||||
//fprintf(stderr,"%02x",ptr[i+1]);
|
||||
}
|
||||
ptr[34] = OP_CHECKSIG;
|
||||
//fprintf(stderr," set ASSETCHAINS_OVERRIDE_PUBKEY33 into vout[1]\n");
|
||||
}
|
||||
//printf("autocreate commision vout\n");
|
||||
} else if ( (uint64_t)(txNew.vout[0].nValue) >= ASSETCHAINS_TIMELOCKGTE) {
|
||||
fprintf(stderr,"timelocked chains not supported in this code!\n");
|
||||
LEAVE_CRITICAL_SECTION(cs_main);
|
||||
@@ -712,7 +687,6 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
//fprintf(stderr, "Created notary payment coinbase totalsat.%lu\n",totalsats);
|
||||
} else fprintf(stderr, "vout 2 of notarization is not OP_RETURN scriptlen.%i\n", scriptlen);
|
||||
}
|
||||
if ( ASSETCHAINS_CBOPRET != 0 )
|
||||
@@ -721,7 +695,6 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
|
||||
txNew.vout.resize(numv+1);
|
||||
txNew.vout[numv].nValue = 0;
|
||||
txNew.vout[numv].scriptPubKey = hush_mineropret(nHeight);
|
||||
//printf("autocreate commision/cbopret.%lld vout[%d]\n",(long long)ASSETCHAINS_CBOPRET,(int32_t)txNew.vout.size());
|
||||
}
|
||||
pblock->vtx[0] = txNew;
|
||||
pblocktemplate->vTxFees[0] = -nFees;
|
||||
@@ -754,7 +727,6 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
|
||||
if ( ASSETCHAINS_CC == 0 && pindexPrev != 0 && (IS_HUSH_NOTARY == 0 || My_notaryid < 0) )
|
||||
{
|
||||
CValidationState state;
|
||||
//fprintf(stderr,"%s: check validity\n", __func__);
|
||||
if ( !TestBlockValidity(state, *pblock, pindexPrev, false, false)) // invokes CC checks
|
||||
{
|
||||
if ( !isStake )
|
||||
@@ -766,14 +738,12 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
|
||||
//throw std::runtime_error("CreateNewBlock(): TestBlockValidity failed"); // crashes the node, moved to GetBlockTemplate and issue return.
|
||||
return(0);
|
||||
}
|
||||
//fprintf(stderr,"valid\n");
|
||||
}
|
||||
}
|
||||
|
||||
LEAVE_CRITICAL_SECTION(cs_main);
|
||||
LEAVE_CRITICAL_SECTION(mempool.cs);
|
||||
|
||||
// fprintf(stderr,"%s: done\n", __func__);
|
||||
return pblocktemplate.release();
|
||||
}
|
||||
|
||||
@@ -783,7 +753,6 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
|
||||
|
||||
void IncrementExtraNonce(CBlock* pblock, CBlockIndex* pindexPrev, unsigned int& nExtraNonce)
|
||||
{
|
||||
//fprintf(stderr,"RandomXMiner: %s with nExtraNonce=%u\n", __func__, nExtraNonce);
|
||||
// Update nExtraNonce
|
||||
static uint256 hashPrevBlock;
|
||||
if (hashPrevBlock != pblock->hashPrevBlock)
|
||||
@@ -807,7 +776,6 @@ void IncrementExtraNonce(CBlock* pblock, CBlockIndex* pindexPrev, unsigned int&
|
||||
CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey, int32_t nHeight, int32_t gpucount, bool isStake)
|
||||
{
|
||||
CPubKey pubkey; CScript scriptPubKey; uint8_t *script,*ptr; int32_t i,len;
|
||||
// fprintf(stderr,"%s: with nHeight=%d\n", __func__, nHeight);
|
||||
|
||||
// Create a local variable instead of modifying the global assetchains_scriptpub
|
||||
auto assetchains_scriptpub = devtax_scriptpub_for_height(nHeight);
|
||||
@@ -817,7 +785,6 @@ CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey, int32_t nHeight,
|
||||
{
|
||||
pubkey = ParseHex(ASSETCHAINS_OVERRIDE_PUBKEY);
|
||||
scriptPubKey = CScript() << ParseHex(HexStr(pubkey)) << OP_CHECKSIG;
|
||||
// fprintf(stderr,"%s: with pubkey=%s\n", __func__, HexStr(pubkey).c_str() );
|
||||
} else {
|
||||
len = strlen(assetchains_scriptpub.c_str());
|
||||
len >>= 1;
|
||||
@@ -826,7 +793,6 @@ CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey, int32_t nHeight,
|
||||
decode_hex(ptr,len,(char *)assetchains_scriptpub.c_str());
|
||||
}
|
||||
} else if ( USE_EXTERNAL_PUBKEY != 0 ) {
|
||||
//fprintf(stderr,"use notary pubkey\n");
|
||||
pubkey = ParseHex(NOTARY_PUBKEY);
|
||||
scriptPubKey = CScript() << ParseHex(HexStr(pubkey)) << OP_CHECKSIG;
|
||||
} else {
|
||||
@@ -854,7 +820,6 @@ CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey, int32_t nHeight,
|
||||
}
|
||||
}
|
||||
}
|
||||
// fprintf(stderr,"%s: calling CreateNewBlock\n", __func__);
|
||||
return CreateNewBlock(pubkey, scriptPubKey, gpucount, isStake);
|
||||
}
|
||||
|
||||
@@ -868,7 +833,6 @@ void hush_sendmessage(int32_t minpeers,int32_t maxpeers,const char *message,std:
|
||||
continue;
|
||||
if ( numsent < minpeers || (rand() % 10) == 0 )
|
||||
{
|
||||
//fprintf(stderr,"pushmessage\n");
|
||||
pnode->PushMessage(message,payload);
|
||||
if ( numsent++ > maxpeers )
|
||||
break;
|
||||
@@ -916,7 +880,6 @@ static bool ProcessBlockFound(CBlock* pblock)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
//fprintf(stderr,"process new block\n");
|
||||
|
||||
// Process this block the same as if we had received it from another node
|
||||
CValidationState state;
|
||||
@@ -993,7 +956,6 @@ CBlockIndex *get_chainactive(int32_t height)
|
||||
}
|
||||
// else fprintf(stderr,"get_chainactive height %d > active.%d\n",height,chainActive.Tip()->GetHeight());
|
||||
}
|
||||
//fprintf(stderr,"get_chainactive null chainActive.Tip() height %d\n",height);
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -1281,13 +1243,11 @@ void static RandomXMiner()
|
||||
randomx_vm *myVM = nullptr;
|
||||
|
||||
try {
|
||||
// fprintf(stderr,"RandomXMiner: mining %s with randomx\n",SMART_CHAIN_SYMBOL);
|
||||
|
||||
rxdebug("%s: mining %s with randomx\n", SMART_CHAIN_SYMBOL);
|
||||
|
||||
while (true)
|
||||
{
|
||||
// fprintf(stderr,"RandomXMiner: beginning mining loop on %s with nExtraNonce=%u\n",SMART_CHAIN_SYMBOL, nExtraNonce);
|
||||
rxdebug("%s: start mining loop on %s with nExtraNonce=%u\n", SMART_CHAIN_SYMBOL, nExtraNonce);
|
||||
|
||||
if (chainparams.MiningRequiresPeers()) {
|
||||
@@ -1305,10 +1265,8 @@ void static RandomXMiner()
|
||||
if (!fvNodesEmpty )//&& !IsInitialBlockDownload())
|
||||
break;
|
||||
MilliSleep(15000);
|
||||
//fprintf(stderr,"fvNodesEmpty %d IsInitialBlockDownload(%s) %d\n",(int32_t)fvNodesEmpty,SMART_CHAIN_SYMBOL,(int32_t)IsInitialBlockDownload());
|
||||
|
||||
} while (true);
|
||||
//fprintf(stderr,"%s Found peers\n",SMART_CHAIN_SYMBOL);
|
||||
miningTimer.start();
|
||||
}
|
||||
|
||||
@@ -1333,7 +1291,6 @@ void static RandomXMiner()
|
||||
Mining_start = (uint32_t)time(NULL);
|
||||
}
|
||||
|
||||
// fprintf(stderr,"RandomXMiner: using initial key with interval=%d and lag=%d\n", randomxInterval, randomxBlockLag);
|
||||
rxdebug("%s: using initial key, interval=%d, lag=%d, Mining_height=%u\n", randomxInterval, randomxBlockLag, Mining_height);
|
||||
// Update the shared dataset key — only one thread will actually rebuild,
|
||||
// others will see the key is already current and skip.
|
||||
@@ -1366,14 +1323,12 @@ void static RandomXMiner()
|
||||
|
||||
// Acquire shared lock to prevent dataset rebuild while we're hashing
|
||||
boost::shared_lock<boost::shared_mutex> datasetLock(g_rxDatasetManager->datasetMtx);
|
||||
//fprintf(stderr,"RandomXMiner: Mining_start=%u\n", Mining_start);
|
||||
#ifdef ENABLE_WALLET
|
||||
CBlockTemplate *ptr = CreateNewBlockWithKey(reservekey, pindexPrev->GetHeight()+1, gpucount, 0);
|
||||
#else
|
||||
CBlockTemplate *ptr = CreateNewBlockWithKey();
|
||||
#endif
|
||||
|
||||
// fprintf(stderr,"RandomXMiner: created new block with Mining_start=%u\n",Mining_start);
|
||||
rxdebug("%s: created new block with Mining_start=%u\n",Mining_start);
|
||||
if ( ptr == 0 )
|
||||
{
|
||||
@@ -1390,7 +1345,6 @@ void static RandomXMiner()
|
||||
sleep(1);
|
||||
continue;
|
||||
}
|
||||
// fprintf(stderr,"RandomXMiner: getting block template\n");
|
||||
rxdebug("%s: getting block template\n");
|
||||
|
||||
unique_ptr<CBlockTemplate> pblocktemplate(ptr);
|
||||
@@ -1419,7 +1373,6 @@ void static RandomXMiner()
|
||||
}
|
||||
rxdebug("%s: incrementing extra nonce\n");
|
||||
IncrementExtraNonce(pblock, pindexPrev, nExtraNonce);
|
||||
// fprintf(stderr,"RandomXMiner: %u transactions in block\n",(int32_t)pblock->vtx.size());
|
||||
LogPrintf("Running HushRandomXMiner with %u transactions in block (%u bytes)\n",pblock->vtx.size(),::GetSerializeSize(*pblock,SER_NETWORK,PROTOCOL_VERSION));
|
||||
|
||||
// Search
|
||||
@@ -1440,7 +1393,6 @@ void static RandomXMiner()
|
||||
}
|
||||
hush_longestchain();
|
||||
|
||||
// fprintf(stderr,"RandomXMiner: solving with nNonce = %s\n",pblock->nNonce.ToString().c_str());
|
||||
rxdebug("%s: solving with nNonce = %s\n",pblock->nNonce.ToString().c_str());
|
||||
arith_uint256 hashTarget;
|
||||
hashTarget = HASHTarget;
|
||||
@@ -1451,7 +1403,6 @@ void static RandomXMiner()
|
||||
randomxInput << rxInput;
|
||||
|
||||
// std::cerr << "RandomXMiner: randomxInput=" << HexStr(randomxInput) << "\n";
|
||||
// fprintf(stderr,"RandomXMiner: created randomxKey=%s , randomxInput.size=%lu\n", randomxKey, randomxInput.size() ); //randomxInput);
|
||||
rxdebug("%s: randomxKey=%s randomxInput=%s\n", randomxKey, HexStr(randomxInput).c_str());
|
||||
|
||||
rxdebug("%s: calculating randomx hash\n");
|
||||
@@ -1480,7 +1431,6 @@ void static RandomXMiner()
|
||||
rxdebug("%s: Checking solution against target\n");
|
||||
pblock->nSolution = soln;
|
||||
solutionTargetChecks.increment();
|
||||
// fprintf(stderr,"%s: solutionTargetChecks=%lu\n", __func__, solutionTargetChecks.get());
|
||||
B = *pblock;
|
||||
h = UintToArith256(B.GetHash());
|
||||
|
||||
@@ -1705,10 +1655,8 @@ void static BitcoinMiner()
|
||||
if (!fvNodesEmpty )//&& !IsInitialBlockDownload())
|
||||
break;
|
||||
MilliSleep(15000);
|
||||
//fprintf(stderr,"fvNodesEmpty %d IsInitialBlockDownload(%s) %d\n",(int32_t)fvNodesEmpty,SMART_CHAIN_SYMBOL,(int32_t)IsInitialBlockDownload());
|
||||
|
||||
} while (true);
|
||||
//fprintf(stderr,"%s Found peers\n",SMART_CHAIN_SYMBOL);
|
||||
miningTimer.start();
|
||||
}
|
||||
//
|
||||
@@ -1731,7 +1679,6 @@ void static BitcoinMiner()
|
||||
}
|
||||
if ( SMART_CHAIN_SYMBOL[0] != 0 && ASSETCHAINS_STAKED == 0 )
|
||||
{
|
||||
//fprintf(stderr,"%s create new block ht.%d\n",SMART_CHAIN_SYMBOL,Mining_height);
|
||||
//sleep(3);
|
||||
}
|
||||
|
||||
@@ -1756,7 +1703,6 @@ void static BitcoinMiner()
|
||||
sleep(1);
|
||||
continue;
|
||||
}
|
||||
//fprintf(stderr,"get template\n");
|
||||
unique_ptr<CBlockTemplate> pblocktemplate(ptr);
|
||||
if (!pblocktemplate.get())
|
||||
{
|
||||
@@ -1784,7 +1730,6 @@ void static BitcoinMiner()
|
||||
}
|
||||
}
|
||||
IncrementExtraNonce(pblock, pindexPrev, nExtraNonce);
|
||||
//fprintf(stderr,"Running HushMiner.%s with %u transactions in block\n",solver.c_str(),(int32_t)pblock->vtx.size());
|
||||
LogPrintf("Running HushMiner.%s with %u transactions in block (%u bytes)\n",solver.c_str(),pblock->vtx.size(),::GetSerializeSize(*pblock,SER_NETWORK,PROTOCOL_VERSION));
|
||||
|
||||
// Search
|
||||
@@ -1800,7 +1745,6 @@ void static BitcoinMiner()
|
||||
gotinvalid = 0;
|
||||
while (true)
|
||||
{
|
||||
//fprintf(stderr,"gotinvalid.%d\n",gotinvalid);
|
||||
if ( gotinvalid != 0 )
|
||||
break;
|
||||
hush_longestchain();
|
||||
@@ -1825,7 +1769,6 @@ void static BitcoinMiner()
|
||||
if ( HUSH_MININGTHREADS > 0 && ASSETCHAINS_STAKED > 0 && ASSETCHAINS_STAKED < 100 && Mining_height > 10 )
|
||||
hashTarget = HASHTarget_POW;
|
||||
//else if ( ASSETCHAINS_ADAPTIVEPOW > 0 )
|
||||
// hashTarget = HASHTarget_POW;
|
||||
else hashTarget = HASHTarget;
|
||||
std::function<bool(std::vector<unsigned char>)> validBlock =
|
||||
#ifdef ENABLE_WALLET
|
||||
@@ -1839,7 +1782,6 @@ void static BitcoinMiner()
|
||||
LogPrint("pow", "- Checking solution against target\n");
|
||||
pblock->nSolution = soln;
|
||||
solutionTargetChecks.increment();
|
||||
// fprintf(stderr, "%s: solutionTargetChecks=%lu\n", __func__, solutionTargetChecks.get());
|
||||
B = *pblock;
|
||||
h = UintToArith256(B.GetHash());
|
||||
/*for (z=31; z>=16; z--)
|
||||
@@ -1859,7 +1801,6 @@ void static BitcoinMiner()
|
||||
}
|
||||
if ( IS_HUSH_NOTARY != 0 && B.nTime > GetTime() )
|
||||
{
|
||||
//fprintf(stderr,"need to wait %d seconds to submit block\n",(int32_t)(B.nTime - GetTime()));
|
||||
while ( GetTime() < B.nTime-2 )
|
||||
{
|
||||
sleep(1);
|
||||
@@ -1893,8 +1834,6 @@ void static BitcoinMiner()
|
||||
{
|
||||
h = UintToArith256(B.GetHash());
|
||||
//for (z=31; z>=0; z--)
|
||||
// fprintf(stderr,"%02x",((uint8_t *)&h)[z]);
|
||||
//fprintf(stderr," Invalid block mined, try again\n");
|
||||
gotinvalid = 1;
|
||||
return(false);
|
||||
}
|
||||
@@ -1969,8 +1908,6 @@ void static BitcoinMiner()
|
||||
if (found) {
|
||||
int32_t i; uint256 hash = pblock->GetHash();
|
||||
//for (i=0; i<32; i++)
|
||||
// fprintf(stderr,"%02x",((uint8_t *)&hash)[i]);
|
||||
//fprintf(stderr," <- %s Block found %d\n",SMART_CHAIN_SYMBOL,Mining_height);
|
||||
//FOUND_BLOCK = 1;
|
||||
//HUSH_MAYBEMINED = Mining_height;
|
||||
break;
|
||||
@@ -2026,7 +1963,6 @@ void static BitcoinMiner()
|
||||
HASHTarget.SetCompact(pblock->nBits);
|
||||
hashTarget = HASHTarget;
|
||||
savebits = pblock->nBits;
|
||||
//hashTarget = HASHTarget_POW = hush_adaptivepow_target(Mining_height,HASHTarget,pblock->nTime);
|
||||
}
|
||||
/*if ( NOTARY_PUBKEY33[0] == 0 )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user