mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-02 18:25:21 +00:00
fix request_chunk
This commit is contained in:
parent
e9ceeb85af
commit
2157eae499
1 changed files with 3 additions and 5 deletions
|
@ -730,15 +730,13 @@ class Network(PrintError):
|
|||
if session is None: session = self.interface.session
|
||||
index = height // 2016
|
||||
size = 2016
|
||||
if tip is not None and height + 2016 >= tip:
|
||||
size = tip - height
|
||||
#if index * 2016 < height:
|
||||
# size = height - index * 2016
|
||||
if tip is not None:
|
||||
size = min(size, tip - index * 2016)
|
||||
size = max(size, 0)
|
||||
res = await session.send_request('blockchain.block.headers', [index * 2016, size])
|
||||
conn = self.blockchain().connect_chunk(index, res['hex'])
|
||||
if not conn:
|
||||
return conn, 0
|
||||
self.blockchain().save_chunk(index, bfh(res['hex']))
|
||||
return conn, res['count']
|
||||
|
||||
@with_interface_lock
|
||||
|
|
Loading…
Add table
Reference in a new issue