-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
staking: use 320-bit integers for target calculations
While a non-weighted stake target hash can fit 236-bit integers[0], the multiplication by the 64-bit stake can cause the weighted target hash to go up to 300-bits. While I think this would have been better fixed by lowering the stake target hash limit to be 192-bit so that the weighted target hash fits 256-bit, this would break consensus and there are already blocks that require weighted target hashes higher than 2**256 to verify. The existing blob_int class requires bits which are multiples of 32, so 320 is used. [0] - src/gridcoin/staking/difficulty.cpp:24 # The PROOF_OF_STAKE_LIMIT is set to uint256 maximum right shifted by 20 resulting in a 236-bit limit. That's enforced by the GRC::GetNextTargetRequired function which is used to generate the nBits of blocks.
- Loading branch information
Showing
4 changed files
with
43 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters