Skip to content

Commit

Permalink
chaingen: More precise ASERT comments.
Browse files Browse the repository at this point in the history
This updates the comments detailing the origin of the polynomial
coefficients in the ASERT calculation to the more precise values which
also matches up with the standalone code.
  • Loading branch information
davecgh committed Jul 24, 2023
1 parent 93c5b39 commit 858d398
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions blockchain/chaingen/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -1308,9 +1308,9 @@ func calcASERTDiff(startDiffBits uint32, powLimit *big.Int, targetSecsPerBlock,
// guaranteed to be positive and a maximum of 17 bits, so it is safe to cast
// to a uint32.
const (
polyCoeff1 uint64 = 195766423245049 // 0.695502049 * 2^48
polyCoeff2 uint64 = 971821376 // 0.2262698 * 2^32
polyCoeff3 uint64 = 5127 // 0.0782318 * 2^16
polyCoeff1 uint64 = 195766423245049 // ceil(0.695502049712533 * 2^48)
polyCoeff2 uint64 = 971821376 // ceil(0.2262697964 * 2^32)
polyCoeff3 uint64 = 5127 // ceil(0.0782318 * 2^16)
)
fracFactor := uint32(1<<16 + (polyCoeff1*frac64+
polyCoeff2*frac64*frac64+
Expand Down

0 comments on commit 858d398

Please sign in to comment.