From 051af72cbd32c52d134e6c349b056bec7337b40d Mon Sep 17 00:00:00 2001 From: miketout Date: Mon, 8 Oct 2018 17:20:31 -0700 Subject: [PATCH] Cap the random additional stake of a block to 1/2 the current stake difficulty --- src/pow.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pow.cpp b/src/pow.cpp index d7b550335..450d9eb1e 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -485,7 +485,9 @@ CChainPower GetBlockProof(const CBlockIndex& block) // as the nonce has a fixed definition for a POS block, add the random amount of "work" from the nonce, so there will // statistically always be a deterministic winner in POS arith_uint256 aNonce; - aNonce = UintToArith256(block.nNonce); + + // random amount of additional stake added is capped to 1/2 the current stake target + aNonce = UintToArith256(block.nNonce) | (bnStakeTarget << (uint64_t)1); // We need to compute 2**256 / (bnTarget+1), but we can't represent 2**256 // as it's too large for a arith_uint256. However, as 2**256 is at least as large