fix bits_to_target on testnet
This commit is contained in:
parent
a04483056f
commit
db76b3862a
|
@ -383,7 +383,8 @@ class Blockchain(util.PrintError):
|
||||||
def bits_to_target(self, bits):
|
def bits_to_target(self, bits):
|
||||||
bitsN = (bits >> 24) & 0xff
|
bitsN = (bits >> 24) & 0xff
|
||||||
if not (bitsN >= 0x03 and bitsN <= 0x1f):
|
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
|
bitsBase = bits & 0xffffff
|
||||||
if not (bitsBase >= 0x8000 and bitsBase <= 0x7fffff):
|
if not (bitsBase >= 0x8000 and bitsBase <= 0x7fffff):
|
||||||
raise Exception("Second part of bits should be in [0x8000, 0x7fffff]")
|
raise Exception("Second part of bits should be in [0x8000, 0x7fffff]")
|
||||||
|
|
Loading…
Reference in New Issue