From a20088330f877866bfca092a905797df37d424fd Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Mon, 16 Dec 2019 12:59:53 -0300 Subject: [PATCH] use buffer write return as written --- torba/torba/client/baseledger.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/torba/torba/client/baseledger.py b/torba/torba/client/baseledger.py index 11a4dbc58..f3cf38518 100644 --- a/torba/torba/client/baseledger.py +++ b/torba/torba/client/baseledger.py @@ -321,11 +321,10 @@ class BaseLedger(metaclass=LedgerRegistry): async with self.headers.checkpointed_connector() as buffer: for chunk in chunks: headers = await chunk - total += len(headers['base64']) - buffer.write( + total += buffer.write( zlib.decompress(base64.b64decode(headers['base64']), wbits=-15, bufsize=600_000) ) - self._download_height = current + buffer.tell() // self.headers.header_size + self._download_height = current + total // self.headers.header_size log.info("Headers sync: %s / %s", self._download_height, target) async def update_headers(self, height=None, headers=None, subscription_update=False):