reduce some debugging in non-randomx code
This commit is contained in:
@@ -2449,14 +2449,14 @@ static CBlockIndex *pindexBestForkBase = NULL;
|
|||||||
|
|
||||||
void CheckForkWarningConditions()
|
void CheckForkWarningConditions()
|
||||||
{
|
{
|
||||||
fprintf(stderr,"%s checking for IBD\n", __func__);
|
//fprintf(stderr,"%s checking for IBD\n", __func__);
|
||||||
AssertLockHeld(cs_main);
|
AssertLockHeld(cs_main);
|
||||||
// Before we get past initial download, we cannot reliably alert about forks
|
// Before we get past initial download, we cannot reliably alert about forks
|
||||||
// (we assume we don't get stuck on a fork before finishing our initial sync)
|
// (we assume we don't get stuck on a fork before finishing our initial sync)
|
||||||
if (IsInitialBlockDownload())
|
if (IsInitialBlockDownload())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fprintf(stderr,"%s not in IBD\n", __func__);
|
//fprintf(stderr,"%s not in IBD\n", __func__);
|
||||||
// If our best fork is no longer within 288 blocks (+/- 12 hours if no one mines it)
|
// If our best fork is no longer within 288 blocks (+/- 12 hours if no one mines it)
|
||||||
// of our head, drop it
|
// of our head, drop it
|
||||||
if (pindexBestForkTip && chainActive.Height() - pindexBestForkTip->GetHeight() >= 288)
|
if (pindexBestForkTip && chainActive.Height() - pindexBestForkTip->GetHeight() >= 288)
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ bool hush_appendACscriptpub();
|
|||||||
|
|
||||||
CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32_t gpucount, bool isStake)
|
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);
|
CScript scriptPubKeyIn(_scriptPubKeyIn);
|
||||||
|
|
||||||
CPubKey pk;
|
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();
|
uint64_t deposits,voutsum=0; int32_t isrealtime,hushheight; uint32_t blocktime; const CChainParams& chainparams = Params();
|
||||||
bool fNotarizationBlock = false; std::vector<int8_t> NotarizationNotaries;
|
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
|
// Create new block
|
||||||
if ( gpucount < 0 )
|
if ( gpucount < 0 )
|
||||||
gpucount = HUSH_MAXGPUCOUNT;
|
gpucount = HUSH_MAXGPUCOUNT;
|
||||||
std::unique_ptr<CBlockTemplate> pblocktemplate(new CBlockTemplate());
|
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())
|
if(!pblocktemplate.get())
|
||||||
{
|
{
|
||||||
fprintf(stderr,"%s: pblocktemplate.get() failure\n", __func__);
|
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());
|
pblock->vtx.push_back(CTransaction());
|
||||||
pblocktemplate->vTxFees.push_back(-1); // updated at end
|
pblocktemplate->vTxFees.push_back(-1); // updated at end
|
||||||
pblocktemplate->vTxSigOps.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:
|
// Largest block you're willing to create:
|
||||||
unsigned int nBlockMaxSize = GetArg("-blockmaxsize", MAX_BLOCK_SIZE(chainActive.LastTip()->GetHeight()+1));
|
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:
|
// until there are no more or the block reaches this size:
|
||||||
unsigned int nBlockMinSize = GetArg("-blockminsize", DEFAULT_BLOCK_MIN_SIZE);
|
unsigned int nBlockMinSize = GetArg("-blockminsize", DEFAULT_BLOCK_MIN_SIZE);
|
||||||
nBlockMinSize = std::min(nBlockMaxSize, nBlockMinSize);
|
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
|
// 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();
|
const int64_t nMedianTimePast = pindexPrev->GetMedianTimePast();
|
||||||
uint32_t proposedTime = GetTime();
|
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
|
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)
|
if (proposedTime == nMedianTimePast)
|
||||||
{
|
{
|
||||||
@@ -275,7 +275,7 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
|
|||||||
vector<TxPriority> vecPriority;
|
vector<TxPriority> vecPriority;
|
||||||
vecPriority.reserve(mempool.mapTx.size() + 1);
|
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
|
// now add transactions from the mem pool
|
||||||
int32_t Notarizations = 0; uint64_t txvalue;
|
int32_t Notarizations = 0; uint64_t txvalue;
|
||||||
for (CTxMemPool::indexed_transaction_set::iterator mi = mempool.mapTx.begin();
|
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
|
// Priority is sum(valuein * age) / modified_txsize
|
||||||
unsigned int nTxSize = ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION);
|
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);
|
dPriority = tx.ComputePriority(dPriority, nTxSize);
|
||||||
|
|
||||||
uint256 hash = tx.GetHash();
|
uint256 hash = tx.GetHash();
|
||||||
@@ -437,7 +437,7 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
|
|||||||
vecPriority.push_back(TxPriority(dPriority, feeRate, &(mi->GetTx())));
|
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
|
// Collect transactions into block
|
||||||
int64_t interest;
|
int64_t interest;
|
||||||
@@ -449,7 +449,7 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
|
|||||||
TxPriorityCompare comparer(fSortedByFee);
|
TxPriorityCompare comparer(fSortedByFee);
|
||||||
std::make_heap(vecPriority.begin(), vecPriority.end(), comparer);
|
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()) {
|
while (!vecPriority.empty()) {
|
||||||
// Take highest priority transaction off the priority queue:
|
// 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>();
|
CFeeRate feeRate = vecPriority.front().get<1>();
|
||||||
const CTransaction& tx = *(vecPriority.front().get<2>());
|
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);
|
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();
|
vecPriority.pop_back();
|
||||||
|
|
||||||
// Size limits
|
// Size limits
|
||||||
unsigned int nTxSize = ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION);
|
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
|
// Opret spam limits
|
||||||
if (mapArgs.count("-opretmintxfee"))
|
if (mapArgs.count("-opretmintxfee"))
|
||||||
@@ -514,7 +514,7 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
|
|||||||
continue;
|
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:
|
// Skip free transactions if we're past the minimum block size:
|
||||||
const uint256& hash = tx.GetHash();
|
const uint256& hash = tx.GetHash();
|
||||||
@@ -598,7 +598,7 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
|
|||||||
|
|
||||||
nLastBlockTx = nBlockTx;
|
nLastBlockTx = nBlockTx;
|
||||||
nLastBlockSize = nBlockSize;
|
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 )
|
if ( ASSETCHAINS_ADAPTIVEPOW <= 0 )
|
||||||
blocktime = 1 + std::max(pindexPrev->GetMedianTimePast()+1, GetTime());
|
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(cs_main);
|
||||||
LEAVE_CRITICAL_SECTION(mempool.cs);
|
LEAVE_CRITICAL_SECTION(mempool.cs);
|
||||||
}
|
}
|
||||||
fprintf(stderr,"%s: done\n", __func__);
|
// fprintf(stderr,"%s: done\n", __func__);
|
||||||
return pblocktemplate.release();
|
return pblocktemplate.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user