// The stake modifier used to hash for a stake kernel is chosen as the stake
// modifier about a selection interval later than the coin generating the kernel
-static bool GetKernelStakeModifier(uint256 hashBlockFrom, uint64_t& nStakeModifier, int& nStakeModifierHeight, int64_t& nStakeModifierTime, bool fPrintProofOfStake)
+static bool GetKernelStakeModifier(const uint256 &hashBlockFrom, uint64_t& nStakeModifier, int& nStakeModifierHeight, int64_t& nStakeModifierTime, bool fPrintProofOfStake)
{
nStakeModifier = 0;
if (!mapBlockIndex.count(hashBlockFrom))
return true;
}
-bool GetKernelStakeModifier(uint256 hashBlockFrom, uint64_t& nStakeModifier)
+bool GetKernelStakeModifier(const uint256 &hashBlockFrom, uint64_t& nStakeModifier)
{
int nStakeModifierHeight;
int64_t nStakeModifierTime;
{
using namespace boost;
- auto nThreads = thread::hardware_concurrency();
+ auto nThreads = boost::thread::hardware_concurrency();
+ if (nThreads == 0) {
+ nThreads = 1;
+ printf("Warning: hardware_concurrency() failed in %s:%d\n", __FILE__, __LINE__);
+ }
auto vWorkers = vector<KernelWorker>(nThreads);
auto nPart = (SearchInterval.second - SearchInterval.first) / nThreads;
thread_group group;
ss << pindex->nFlags << pindex->hashProofOfStake << pindex->nStakeModifier;
auto hashChecksum = Hash(ss.begin(), ss.end());
hashChecksum >>= (256 - 32);
- return static_cast<uint32_t>(hashChecksum.Get64());
+ return hashChecksum.Get32();
}
// Check stake modifier hard checkpoints