|
@ -56,8 +56,7 @@ class Blockchain(util.PrintError): |
|
|
self.verify_header(header, prev_header, bits, target) |
|
|
self.verify_header(header, prev_header, bits, target) |
|
|
prev_header = header |
|
|
prev_header = header |
|
|
|
|
|
|
|
|
def verify_chunk(self, index, hexdata): |
|
|
def verify_chunk(self, index, data): |
|
|
data = hexdata.decode('hex') |
|
|
|
|
|
num = len(data) / 80 |
|
|
num = len(data) / 80 |
|
|
prev_header = None |
|
|
prev_header = None |
|
|
if index != 0: |
|
|
if index != 0: |
|
@ -212,11 +211,12 @@ class Blockchain(util.PrintError): |
|
|
self.print_error(str(e)) |
|
|
self.print_error(str(e)) |
|
|
return False |
|
|
return False |
|
|
|
|
|
|
|
|
def connect_chunk(self, idx, chunk): |
|
|
def connect_chunk(self, idx, hexdata): |
|
|
try: |
|
|
try: |
|
|
self.verify_chunk(idx, chunk) |
|
|
data = hexdata.decode('hex') |
|
|
self.print_error("validated chunk %d" % index) |
|
|
self.verify_chunk(idx, data) |
|
|
self.save_chunk(index, data) |
|
|
self.print_error("validated chunk %d" % idx) |
|
|
|
|
|
self.save_chunk(idx, data) |
|
|
return idx + 1 |
|
|
return idx + 1 |
|
|
except BaseException as e: |
|
|
except BaseException as e: |
|
|
self.print_error('verify_chunk failed', str(e)) |
|
|
self.print_error('verify_chunk failed', str(e)) |
|
|