|
@ -56,7 +56,7 @@ class Blockchain(util.PrintError): |
|
|
def verify_header(self, header, prev_header, bits, target): |
|
|
def verify_header(self, header, prev_header, bits, target): |
|
|
prev_hash = self.hash_header(prev_header) |
|
|
prev_hash = self.hash_header(prev_header) |
|
|
assert prev_hash == header.get('prev_block_hash'), "prev hash mismatch: %s vs %s" % (prev_hash, header.get('prev_block_hash')) |
|
|
assert prev_hash == header.get('prev_block_hash'), "prev hash mismatch: %s vs %s" % (prev_hash, header.get('prev_block_hash')) |
|
|
if bitcoin.TESTNET: return |
|
|
if bitcoin.TESTNET or bitcoin.NOLNET: return |
|
|
assert bits == header.get('bits'), "bits mismatch: %s vs %s" % (bits, header.get('bits')) |
|
|
assert bits == header.get('bits'), "bits mismatch: %s vs %s" % (bits, header.get('bits')) |
|
|
_hash = self.hash_header(header) |
|
|
_hash = self.hash_header(header) |
|
|
assert int('0x' + _hash, 16) <= target, "insufficient proof of work: %s vs target %s" % (int('0x' + _hash, 16), target) |
|
|
assert int('0x' + _hash, 16) <= target, "insufficient proof of work: %s vs target %s" % (int('0x' + _hash, 16), target) |
|
|