Skip to content

Commit

Permalink
Merge pull request #2215 from RoboticMind/remove-unused-vars
Browse files Browse the repository at this point in the history
refactor: Remove msMiningErrorsIncluded & msMiningErrorsExcluded
  • Loading branch information
jamescowens committed Jul 7, 2021
2 parents 9078fb7 + 9e07201 commit a8054de
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 26 deletions.
2 changes: 0 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,6 @@ bool bGridcoinCoreInitComplete = false;

// Mining status variables
std::string msMiningErrors;
std::string msMiningErrorsIncluded;
std::string msMiningErrorsExcluded;

//When syncing, we grandfather block rejection rules up to this block, as rules became stricter over time and fields changed
int nGrandfather = 1034700;
Expand Down
2 changes: 0 additions & 2 deletions src/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,6 @@ extern bool fEnforceCanonical;
static const uint64_t nMinDiskSpace = 52428800;

extern std::string msMiningErrors;
extern std::string msMiningErrorsIncluded;
extern std::string msMiningErrorsExcluded;

extern int nGrandfather;

Expand Down
20 changes: 0 additions & 20 deletions src/miner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,6 @@ bool CreateRestOfTheBlock(CBlock &block, CBlockIndex* pindexPrev)
vOrphan.push_back(COrphan(&tx));
porphan = &vOrphan.back();
LogPrint(BCLog::LogFlags::NOISY, "Orphan tx %s ",tx.GetHash().GetHex());
msMiningErrorsExcluded += tx.GetHash().GetHex() + ":ORPHAN;";
}
mapDependers[txin.prevout.hash].push_back(porphan);
porphan->setDependsOn.insert(txin.prevout.hash);
Expand Down Expand Up @@ -343,28 +342,19 @@ bool CreateRestOfTheBlock(CBlock &block, CBlockIndex* pindexPrev)
if (nBlockSize + nTxSize >= nBlockMaxSize)
{
LogPrintf("Tx size too large for tx %s blksize %" PRIu64 ", tx size %" PRId64, tx.GetHash().GetHex(), nBlockSize, nTxSize);
msMiningErrorsExcluded += tx.GetHash().GetHex() + ":SizeTooLarge("
+ ToString(nBlockSize) + "," + ToString(nTxSize) + ")("
+ ToString(nBlockSize) + ");";

continue;
}

// Legacy limits on sigOps:
unsigned int nTxSigOps = GetLegacySigOpCount(tx);
if (nBlockSigOps + nTxSigOps >= MAX_BLOCK_SIGOPS)
{
msMiningErrorsExcluded += tx.GetHash().GetHex() + ":LegacySigOpLimit(" +
ToString(nBlockSigOps) + "," + ToString(nTxSigOps) + ")("
+ ToString(MAX_BLOCK_SIGOPS) + ");";
continue;
}

// Timestamp limit
if (tx.nTime > block.nTime)
{
msMiningErrorsExcluded += tx.GetHash().GetHex() + ":TimestampLimit(" + ToString(tx.nTime) + ","
+ ToString(block.vtx[0].nTime) + ");";
continue;
}

Expand Down Expand Up @@ -393,7 +383,6 @@ bool CreateRestOfTheBlock(CBlock &block, CBlockIndex* pindexPrev)
if (!FetchInputs(tx, txdb, mapTestPoolTmp, false, true, mapInputs, fInvalid))
{
LogPrint(BCLog::LogFlags::NOISY, "Unable to fetch inputs for tx %s ", tx.GetHash().GetHex());
msMiningErrorsExcluded += tx.GetHash().GetHex() + ":UnableToFetchInputs;";
continue;
}

Expand All @@ -403,8 +392,6 @@ bool CreateRestOfTheBlock(CBlock &block, CBlockIndex* pindexPrev)
LogPrint(BCLog::LogFlags::NOISY,
"Not including tx %s due to TxFees of %" PRId64 ", bare min fee is %" PRId64,
tx.GetHash().GetHex(), nTxFees, nMinFee);
msMiningErrorsExcluded += tx.GetHash().GetHex() + ":FeeTooSmall("
+ RoundToString(CoinToDouble(nFees),8) + "," +RoundToString(CoinToDouble(nMinFee),8) + ");";
continue;
}

Expand All @@ -413,24 +400,17 @@ bool CreateRestOfTheBlock(CBlock &block, CBlockIndex* pindexPrev)
{
LogPrint(BCLog::LogFlags::NOISY, "Not including tx %s due to exceeding max sigops of %d, sigops is %d",
tx.GetHash().GetHex(), (nBlockSigOps+nTxSigOps), MAX_BLOCK_SIGOPS);
msMiningErrorsExcluded += tx.GetHash().GetHex() + ":ExceededSigOps("
+ ToString(nBlockSigOps) + "," + ToString(nTxSigOps) + ")("
+ ToString(MAX_BLOCK_SIGOPS) + ");";

continue;
}

if (!ConnectInputs(tx, txdb, mapInputs, mapTestPoolTmp, CDiskTxPos(1,1,1), pindexPrev, false, true))
{
LogPrint(BCLog::LogFlags::NOISY, "Unable to connect inputs for tx %s ",tx.GetHash().GetHex());
msMiningErrorsExcluded += tx.GetHash().GetHex() + ":UnableToConnectInputs();";
continue;
}
mapTestPoolTmp[tx.GetHash()] = CTxIndex(CDiskTxPos(1,1,1), tx.vout.size());
swap(mapTestPool, mapTestPoolTmp);

// Added
msMiningErrorsIncluded += tx.GetHash().GetHex() + ";";
block.vtx.push_back(tx);
nBlockSize += nTxSize;
++nBlockTx;
Expand Down
2 changes: 0 additions & 2 deletions src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,6 @@ bool ConnectInputs(CTransaction& tx, CTxDB& txdb, MapPrevTx inputs, std::map<uin
{
if (fMiner)
{
msMiningErrorsExcluded += " ConnectInputs() : " + tx.GetHash().GetHex() + " used at "
+ txindex.vSpent[prevout.n].ToString() + "; ";
return false;
}
if (!txindex.vSpent[prevout.n].IsNull())
Expand Down

0 comments on commit a8054de

Please sign in to comment.