interface: rm unnecessary writes to self.tip
This commit is contained in:
@@ -339,7 +339,6 @@ class Interface(PrintError):
|
|||||||
if self.tip < height:
|
if self.tip < height:
|
||||||
height = self.tip
|
height = self.tip
|
||||||
_, height = await self.step(height, item)
|
_, height = await self.step(height, item)
|
||||||
self.tip = max(height, self.tip)
|
|
||||||
|
|
||||||
async def sync_until(self, height, next_height=None):
|
async def sync_until(self, height, next_height=None):
|
||||||
if next_height is None:
|
if next_height is None:
|
||||||
@@ -348,12 +347,10 @@ class Interface(PrintError):
|
|||||||
while last is None or height < next_height:
|
while last is None or height < next_height:
|
||||||
if next_height > height + 10:
|
if next_height > height + 10:
|
||||||
could_connect, num_headers = await self.request_chunk(height, next_height)
|
could_connect, num_headers = await self.request_chunk(height, next_height)
|
||||||
self.tip = max(height + num_headers, self.tip)
|
|
||||||
if not could_connect:
|
if not could_connect:
|
||||||
if height <= constants.net.max_checkpoint():
|
if height <= constants.net.max_checkpoint():
|
||||||
raise Exception('server chain conflicts with checkpoints or genesis')
|
raise Exception('server chain conflicts with checkpoints or genesis')
|
||||||
last, height = await self.step(height)
|
last, height = await self.step(height)
|
||||||
self.tip = max(height, self.tip)
|
|
||||||
continue
|
continue
|
||||||
height = (height // 2016 * 2016) + num_headers
|
height = (height // 2016 * 2016) + num_headers
|
||||||
if height > next_height:
|
if height > next_height:
|
||||||
@@ -361,7 +358,6 @@ class Interface(PrintError):
|
|||||||
last = 'catchup'
|
last = 'catchup'
|
||||||
else:
|
else:
|
||||||
last, height = await self.step(height)
|
last, height = await self.step(height)
|
||||||
self.tip = max(height, self.tip)
|
|
||||||
return last, height
|
return last, height
|
||||||
|
|
||||||
async def step(self, height, header=None):
|
async def step(self, height, header=None):
|
||||||
@@ -509,6 +505,7 @@ class Interface(PrintError):
|
|||||||
height = bh + 1
|
height = bh + 1
|
||||||
return 'no_fork', height
|
return 'no_fork', height
|
||||||
|
|
||||||
|
|
||||||
def check_cert(host, cert):
|
def check_cert(host, cert):
|
||||||
try:
|
try:
|
||||||
b = pem.dePem(cert, 'CERTIFICATE')
|
b = pem.dePem(cert, 'CERTIFICATE')
|
||||||
|
|||||||
Reference in New Issue
Block a user