Skip to content

Commit

Permalink
Merge pull request #1701 from cyrossignol/cleanup-legacy-network-timer
Browse files Browse the repository at this point in the history
Remove unused NetworkTimer() function and global state
  • Loading branch information
jamescowens committed Jun 1, 2020
2 parents bea8bc6 + 96eaab8 commit 411064f
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 38 deletions.
7 changes: 0 additions & 7 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,6 @@ bool PollIsActive(const std::string& poll_contract);

extern bool LessVerbose(int iMax1000);

///////////////////////////////
// Standard Boinc Projects ////
///////////////////////////////

//Global variables to display current mined project in various placesn:
double mdPORNonce = 0;
double mdMachineTimerLast = 0;
// Mining status variables
std::string msMiningErrors;
std::string msPoll;
Expand Down
4 changes: 0 additions & 4 deletions src/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,6 @@ extern bool fEnforceCanonical;
// Minimum disk space required - used in CheckDiskSpace()
static const uint64_t nMinDiskSpace = 52428800;

// PoB Miner Global Vars:
extern double mdPORNonce;
extern double mdMachineTimerLast;

extern std::string msMiningErrors;
extern std::string msPoll;

Expand Down
15 changes: 8 additions & 7 deletions src/miner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -573,22 +573,23 @@ bool CreateCoinStake( CBlock &blocknew, CKey &key,
StakeDiffMax = std::max(StakeDiffMax,StakeKernelDiff);

LogPrint(BCLog::LogFlags::MINER,
"CreateCoinStake: V%d Time %.f, Por_Nonce %.f, Bits %jd, Weight %jd\n"
"CreateCoinStake: V%d Time %d, Bits %u, Weight %" PRId64 "\n"
" Stk %72s\n"
" Trg %72s\n"
" Diff %0.7f of %0.7f",
blocknew.nVersion,
(double)txnew.nTime, mdPORNonce,
(intmax_t)blocknew.nBits,(intmax_t)CoinWeight,
StakeKernelHash.GetHex().c_str(), StakeTarget.GetHex().c_str(),
StakeKernelDiff, GetBlockDifficulty(blocknew.nBits)
);
txnew.nTime,
blocknew.nBits,
CoinWeight,
StakeKernelHash.GetHex(),
StakeTarget.GetHex(),
StakeKernelDiff,
GetBlockDifficulty(blocknew.nBits));

if( StakeKernelHash <= StakeTarget )
{
// Found a kernel
LogPrintf("CreateCoinStake: Found Kernel;");
blocknew.nNonce= mdPORNonce;
vector<valtype> vSolutions;
txnouttype whichType;
CScript scriptPubKeyOut;
Expand Down
19 changes: 0 additions & 19 deletions src/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1849,25 +1849,6 @@ bool CWallet::GetStakeWeight(uint64_t& nWeight)
return true;
}


void NetworkTimer()
{
if (GetArg("-fullbore", "false") != "true") MilliSleep(1);
if (mdMachineTimerLast == 0) mdMachineTimerLast = GetAdjustedTime();
double elapsed = GetAdjustedTime() - mdMachineTimerLast;
mdPORNonce += 1;
if (elapsed < 5) return;
mdMachineTimerLast = GetAdjustedTime();
if (elapsed < 1) elapsed = 1;
mdPORNonce += (elapsed*10);
if (mdPORNonce > 2147483000)
{
LogPrintf("Resetting...");
mdPORNonce=0;
}
}


// Call after CreateTransaction unless you want to abort
bool CWallet::CommitTransaction(CWalletTx& wtxNew, CReserveKey& reservekey)
{
Expand Down
1 change: 0 additions & 1 deletion src/wallet.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

extern bool fWalletUnlockStakingOnly;
extern bool fConfChange;
void NetworkTimer();
class CAccountingEntry;
class CWalletTx;
class CReserveKey;
Expand Down

0 comments on commit 411064f

Please sign in to comment.