Commit 1fbe216f authored by Tom Bradshaw's avatar Tom Bradshaw

Add staking_active to getinfo RPC

parent 492e309f
......@@ -71,6 +71,7 @@ bool fIsBareMultisigStd = true;
bool fCheckBlockIndex = false;
size_t nCoinCacheUsage = 5000 * 300;
bool fAlerts = DEFAULT_ALERTS;
int nLastStakeAttempt = 0;
/** Fees smaller than this (in cSats) are considered zero fee (for relaying and mining)
* We are ~100 times smaller then bitcoin now (2015-06-23), set minRelayTxFee only 10 times higher
......
......@@ -145,6 +145,7 @@ extern CFeeRate minRelayTxFee;
extern bool fAlerts;
extern bool fLargeWorkForkFound;
extern bool fLargeWorkInvalidChainFound;
extern int nLastStakeAttempt;
extern std::map<uint256, int64_t> mapRejectedBlocks;
......
......@@ -94,6 +94,7 @@ Value getinfo(const Array& params, bool fHelp)
obj.push_back(Pair("proxy", (proxy.IsValid() ? proxy.ToStringIPPort() : string())));
obj.push_back(Pair("difficulty", (double)GetDifficulty()));
obj.push_back(Pair("testnet", Params().TestnetToBeDeprecatedFieldRPC()));
obj.push_back(Pair("staking_active", (bool)(GetTime() - nLastStakeAttempt < 120)));
#ifdef ENABLE_WALLET
if (pwalletMain) {
obj.push_back(Pair("keypoololdest", pwalletMain->GetOldestKeyPoolTime()));
......
......@@ -1947,6 +1947,7 @@ bool CWallet::CreateCoinStake(const int nHeight, const uint32_t& nBits, const ui
auto pOutpoint = std::make_pair(pointer.txid, pointer.nPos);
Kernel kernel(pOutpoint, nAmountMN, nStakeModifier, pindex->GetBlockTime(), nTxNewTime);
uint256 nTarget = ArithToUint256(arith_uint256().SetCompact(nBits));
nLastStakeAttempt = GetTime();
if (!SearchTimeSpan(kernel, nTime, nTime + STAKE_SEARCH_INTERVAL, nTarget))
continue;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment