tinterface: fix off-by-one in request_chunk - electrum - Electrum Bitcoin wallet
HTML git clone https://git.parazyd.org/electrum
DIR Log
DIR Files
DIR Refs
DIR Submodules
---
DIR commit 9c919e6478a97b10352d4324d9323da0cbec3ac3
DIR parent 1d711eeadc754024bfba9b12822635ec4a013984
HTML Author: SomberNight <somber.night@protonmail.com>
Date: Sun, 16 Sep 2018 09:01:53 +0200
interface: fix off-by-one in request_chunk
was harmless; usually we just downloaded an extra individual header after the chunk
Diffstat:
M electrum/interface.py | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
---
DIR diff --git a/electrum/interface.py b/electrum/interface.py
t@@ -326,7 +326,7 @@ class Interface(PrintError):
self.print_error("requesting chunk from height {}".format(height))
size = 2016
if tip is not None:
- size = min(size, tip - index * 2016)
+ size = min(size, tip - index * 2016 + 1)
size = max(size, 0)
try:
self._requested_chunks.add(index)
t@@ -411,8 +411,7 @@ class Interface(PrintError):
continue
self.network.notify('updated')
height = (height // 2016 * 2016) + num_headers
- if height > next_height:
- assert False, (height, self.tip)
+ assert height <= next_height+1, (height, self.tip)
last = 'catchup'
else:
last, height = await self.step(height)