Floor disk_count at zero.
This commit is contained in:
parent
ccf24fdc71
commit
8617c82ec2
@ -828,7 +828,7 @@ class BlockProcessor(server.db.DB):
|
|||||||
|
|
||||||
def read_headers(self, start, count):
|
def read_headers(self, start, count):
|
||||||
# Read some from disk
|
# Read some from disk
|
||||||
disk_count = min(count, self.fs_height + 1 - start)
|
disk_count = min(count, max(0, self.fs_height + 1 - start))
|
||||||
result = self.fs_read_headers(start, disk_count)
|
result = self.fs_read_headers(start, disk_count)
|
||||||
count -= disk_count
|
count -= disk_count
|
||||||
start += disk_count
|
start += disk_count
|
||||||
|
|||||||
@ -143,6 +143,7 @@ class DB(LoggedClass):
|
|||||||
raise
|
raise
|
||||||
|
|
||||||
def fs_read_headers(self, start, count):
|
def fs_read_headers(self, start, count):
|
||||||
|
'''Requires count >= 0.'''
|
||||||
# Read some from disk
|
# Read some from disk
|
||||||
disk_count = min(count, self.db_height + 1 - start)
|
disk_count = min(count, self.db_height + 1 - start)
|
||||||
if start < 0 or count < 0 or disk_count != count:
|
if start < 0 or count < 0 or disk_count != count:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user