remove dead code

This commit is contained in:
ThomasV 2017-07-25 18:57:34 +02:00
parent 810f107229
commit 94f7a87e47
1 changed files with 1 additions and 15 deletions

View File

@ -159,15 +159,6 @@ class Blockchain(util.PrintError):
if int('0x' + _hash, 16) > target:
raise BaseException("insufficient proof of work: %s vs target %s" % (int('0x' + _hash, 16), target))
def verify_chain(self, chain):
first_header = chain[0]
prev_header = self.read_header(first_header.get('block_height') - 1)
for header in chain:
height = header.get('block_height')
bits, target = self.get_target(height / 2016, chain)
self.verify_header(header, prev_header, bits, target)
prev_header = header
def verify_chunk(self, index, data):
num = len(data) / 80
prev_header = None
@ -275,18 +266,13 @@ class Blockchain(util.PrintError):
h = self.local_height
return sum([self.BIP9(h-i, 2) for i in range(N)])*10000/N/100.
def get_target(self, index, chain=None):
def get_target(self, index):
if bitcoin.TESTNET:
return 0, 0
if index == 0:
return 0x1d00ffff, MAX_TARGET
first = self.read_header((index-1) * 2016)
last = self.read_header(index*2016 - 1)
if last is None:
for h in chain:
if h.get('block_height') == index*2016 - 1:
last = h
assert last is not None
# bits to target
bits = last.get('bits')
bitsN = (bits >> 24) & 0xff