reduce some debugging in non-randomx code
This commit is contained in:
@@ -154,7 +154,7 @@ bool hush_appendACscriptpub();
|
||||
|
||||
CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32_t gpucount, bool isStake)
|
||||
{
|
||||
fprintf(stderr,"%s\n", __func__);
|
||||
//fprintf(stderr,"%s\n", __func__);
|
||||
CScript scriptPubKeyIn(_scriptPubKeyIn);
|
||||
|
||||
CPubKey pk;
|
||||
@@ -173,12 +173,12 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
|
||||
uint64_t deposits,voutsum=0; int32_t isrealtime,hushheight; 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());
|
||||
//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__);
|
||||
//fprintf(stderr,"%s: created new block template\n", __func__);
|
||||
if(!pblocktemplate.get())
|
||||
{
|
||||
fprintf(stderr,"%s: pblocktemplate.get() failure\n", __func__);
|
||||
@@ -194,7 +194,7 @@ 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__);
|
||||
//fprintf(stderr,"%s: added dummy coinbase\n", __func__);
|
||||
|
||||
// Largest block you're willing to create:
|
||||
unsigned int nBlockMaxSize = GetArg("-blockmaxsize", MAX_BLOCK_SIZE(chainActive.LastTip()->GetHeight()+1));
|
||||
@@ -210,7 +210,7 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
|
||||
// until there are no more or the block reaches this size:
|
||||
unsigned int nBlockMinSize = 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);
|
||||
//fprintf(stderr,"%s: nBlockMaxSize=%u, nBlockPrioritySize=%u, nBlockMinSize=%u\n", __func__, nBlockMaxSize, nBlockPrioritySize, nBlockMinSize);
|
||||
|
||||
|
||||
// Collect memory pool transactions into the block
|
||||
@@ -235,10 +235,10 @@ 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);
|
||||
//fprintf(stderr,"%s: nHeight=%d, consensusBranchId=%u, proposedTime=%u\n", __func__, nHeight, consensusBranchId, proposedTime);
|
||||
|
||||
voutsum = GetBlockSubsidy(nHeight,consensusParams) + 10000*COIN; // approx fees
|
||||
fprintf(stderr,"%s: voutsum=%lu\n", __func__, voutsum);
|
||||
//fprintf(stderr,"%s: voutsum=%lu\n", __func__, voutsum);
|
||||
|
||||
if (proposedTime == nMedianTimePast)
|
||||
{
|
||||
@@ -275,7 +275,7 @@ 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__);
|
||||
//fprintf(stderr,"%s: going to add txs from mempool\n", __func__);
|
||||
// now add transactions from the mem pool
|
||||
int32_t Notarizations = 0; uint64_t txvalue;
|
||||
for (CTxMemPool::indexed_transaction_set::iterator mi = mempool.mapTx.begin();
|
||||
@@ -391,7 +391,7 @@ 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);
|
||||
// fprintf(stderr,"%s: computing priority with nTxSize=%u\n", __func__, nTxSize);
|
||||
dPriority = tx.ComputePriority(dPriority, nTxSize);
|
||||
|
||||
uint256 hash = tx.GetHash();
|
||||
@@ -437,7 +437,7 @@ 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__);
|
||||
// fprintf(stderr,"%s: done adding txs from mempool\n", __func__);
|
||||
|
||||
// Collect transactions into block
|
||||
int64_t interest;
|
||||
@@ -449,7 +449,7 @@ 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);
|
||||
// fprintf(stderr,"%s: compared txs with fSortedByFee=%d\n", __func__, fSortedByFee);
|
||||
|
||||
while (!vecPriority.empty()) {
|
||||
// Take highest priority transaction off the priority queue:
|
||||
@@ -457,15 +457,15 @@ 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__);
|
||||
// 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__);
|
||||
// fprintf(stderr,"%s: compared first tx from priority queue\n", __func__);
|
||||
vecPriority.pop_back();
|
||||
|
||||
// Size limits
|
||||
unsigned int nTxSize = ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION);
|
||||
fprintf(stderr,"%s: nTxSize = %u\n", __func__, nTxSize);
|
||||
// fprintf(stderr,"%s: nTxSize = %u\n", __func__, nTxSize);
|
||||
|
||||
// Opret spam limits
|
||||
if (mapArgs.count("-opretmintxfee"))
|
||||
@@ -514,7 +514,7 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
|
||||
continue;
|
||||
}
|
||||
|
||||
fprintf(stderr,"%s: looking to see if we need to skip any fee=0 txs\n", __func__);
|
||||
// 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();
|
||||
@@ -598,7 +598,7 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
|
||||
|
||||
nLastBlockTx = nBlockTx;
|
||||
nLastBlockSize = nBlockSize;
|
||||
fprintf(stderr,"%s: nLastBlockTx=%lu , nLastBlockSize=%lu\n", __func__, nLastBlockTx, nLastBlockSize);
|
||||
// fprintf(stderr,"%s: nLastBlockTx=%lu , nLastBlockSize=%lu\n", __func__, nLastBlockTx, nLastBlockSize);
|
||||
|
||||
if ( ASSETCHAINS_ADAPTIVEPOW <= 0 )
|
||||
blocktime = 1 + std::max(pindexPrev->GetMedianTimePast()+1, GetTime());
|
||||
@@ -784,7 +784,7 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
|
||||
LEAVE_CRITICAL_SECTION(cs_main);
|
||||
LEAVE_CRITICAL_SECTION(mempool.cs);
|
||||
}
|
||||
fprintf(stderr,"%s: done\n", __func__);
|
||||
// fprintf(stderr,"%s: done\n", __func__);
|
||||
return pblocktemplate.release();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user