mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-06-13 09:36:44 +00:00
rpcserver: Increase getblock difficulty prec to 8.
This commit increases the precision of the difficulty field of the getblock RPC to 8 to match Bitcoin Core. Closes #414.
This commit is contained in:
parent
005b540895
commit
2dfb4be707
@ -911,7 +911,7 @@ func getDifficultyRatio(bits uint32) float64 {
|
|||||||
target := blockchain.CompactToBig(bits)
|
target := blockchain.CompactToBig(bits)
|
||||||
|
|
||||||
difficulty := new(big.Rat).SetFrac(max, target)
|
difficulty := new(big.Rat).SetFrac(max, target)
|
||||||
outString := difficulty.FloatString(2)
|
outString := difficulty.FloatString(8)
|
||||||
diff, err := strconv.ParseFloat(outString, 64)
|
diff, err := strconv.ParseFloat(outString, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
rpcsLog.Errorf("Cannot get difficulty: %v", err)
|
rpcsLog.Errorf("Cannot get difficulty: %v", err)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user