asdadsasa

This commit is contained in:
Thomas Zarebczan 2018-11-16 19:21:58 -05:00
parent f6bdbf17f0
commit fc4c5220b1

View file

@ -221,10 +221,10 @@ class Blockchain(util.PrintError):
raise Exception("prev hash mismatch: %s vs %s" % (prev_hash, header.get('prev_block_hash')))
if constants.net.TESTNET:
return
if bits != header.get('bits'):
raise Exception("bits mismatch: %s vs %s" % (bits, header.get('bits')))
if int('0x' + _hash, 16) > target:
raise Exception("insufficient proof of work: %s vs target %s" % (int('0x' + _hash, 16), target))
#if bits != header.get('bits'):
# raise Exception("bits mismatch: %s vs %s" % (bits, header.get('bits')))
#if int('0x' + _hash, 16) > target:
# raise Exception("insufficient proof of work: %s vs target %s" % (int('0x' + _hash, 16), target))
def verify_chunk(self, index: int, data: bytes) -> None:
num = len(data) // HEADER_SIZE
@ -428,7 +428,7 @@ class Blockchain(util.PrintError):
return GENESIS_BITS, MAX_TARGET
if index == 0:
return GENESIS_BITS, MAX_TARGET
first = self.read_header(index)
first = self.read_header(index-1)
assert last is not None, "Last shouldn't be none"
# bits to target
bits = last.get('bits')