force new headers download if file is corrupted
This commit is contained in:
@@ -258,7 +258,7 @@ class Blockchain(util.PrintError):
|
|||||||
return deserialize_header(h, height)
|
return deserialize_header(h, height)
|
||||||
|
|
||||||
def get_hash(self, height):
|
def get_hash(self, height):
|
||||||
return bitcoin.GENESIS if height == 0 else hash_header(self.read_header(height))
|
return hash_header(self.read_header(height))
|
||||||
|
|
||||||
def BIP9(self, height, flag):
|
def BIP9(self, height, flag):
|
||||||
v = self.read_header(height)['version']
|
v = self.read_header(height)['version']
|
||||||
|
|||||||
@@ -946,10 +946,11 @@ class Network(util.DaemonThread):
|
|||||||
self.process_responses(interface)
|
self.process_responses(interface)
|
||||||
|
|
||||||
def init_headers_file(self):
|
def init_headers_file(self):
|
||||||
filename = self.blockchains[0].path()
|
b = self.blockchains[0]
|
||||||
if os.path.exists(filename):
|
if b.get_hash(0) == bitcoin.GENESIS:
|
||||||
self.downloading_headers = False
|
self.downloading_headers = False
|
||||||
return
|
return
|
||||||
|
filename = b.path()
|
||||||
def download_thread():
|
def download_thread():
|
||||||
try:
|
try:
|
||||||
import urllib, socket
|
import urllib, socket
|
||||||
|
|||||||
Reference in New Issue
Block a user