From 9fac8ea7f84d33c537cf66ec9900b224ed53b4fb Mon Sep 17 00:00:00 2001 From: CryptoManiac Date: Mon, 12 Oct 2015 15:39:44 -0700 Subject: [PATCH] Fix sha256 context initialization --- src/kernel.cpp | 15 +++++++-------- 1 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/kernel.cpp b/src/kernel.cpp index 9f24f0b..7c2b5c7 100644 --- a/src/kernel.cpp +++ b/src/kernel.cpp @@ -584,17 +584,16 @@ public: uint256 nMaxTarget = (bnTargetPerCoinDay * bnValueIn * nStakeMaxAge / COIN / nOneDay).getuint256(); #ifdef __i386__ - SHA256_CTX ctx = workerCtx; + SHA256_CTX ctx, workerCtx; + // Init new sha256 context and update it + // with first 24 bytes of kernel + SHA256_Init(&ctx); + SHA256_Update(&ctx, kernel, 8 + 16); + workerCtx = ctx; // save context // Sha256 result buffer uint32_t hashProofOfStake[8]; - - // Compute maximum possible target to filter out majority of obviously insufficient hashes - CBigNum bnTargetPerCoinDay; - bnTargetPerCoinDay.SetCompact(nBits); - - uint256 nMaxTarget = (bnTargetPerCoinDay * bnValueIn * nStakeMaxAge / COIN / nOneDay).getuint256(), - *pnHashProofOfStake = (uint256 *)&hashProofOfStake; + uint256 *pnHashProofOfStake = (uint256 *)&hashProofOfStake; // Search forward in time from the given timestamp // Stopping search in case of shutting down -- 1.7.1