fix bits_to_target on testnet

This commit is contained in:
zebra-lucky 2018-07-01 03:56:21 +03:00
parent a04483056f
commit db76b3862a
1 changed files with 2 additions and 1 deletions

View File

@ -383,7 +383,8 @@ class Blockchain(util.PrintError):
def bits_to_target(self, bits):
bitsN = (bits >> 24) & 0xff
if not (bitsN >= 0x03 and bitsN <= 0x1f):
raise Exception("First part of bits should be in [0x03, 0x1f]")
if not constants.net.TESTNET:
raise Exception("First part of bits should be in [0x03, 0x1f]")
bitsBase = bits & 0xffffff
if not (bitsBase >= 0x8000 and bitsBase <= 0x7fffff):
raise Exception("Second part of bits should be in [0x8000, 0x7fffff]")