Assert acount hash mmap file capacity > 0 (#33575)

assert mmap capacity > 0

Co-authored-by: HaoranYi <haoran.yi@solana.com>
This commit is contained in:
HaoranYi 2023-10-09 09:38:00 -05:00 committed by GitHub
parent 46cf79a9c4
commit 72574dac02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions

View File

@ -97,6 +97,7 @@ impl AccountHashesFile {
// Theoretical performance optimization: write a zero to the end of
// the file so that we won't have to resize it later, which may be
// expensive.
assert!(self.capacity > 0);
data.seek(SeekFrom::Start((self.capacity - 1) as u64))
.unwrap();
data.write_all(&[0]).unwrap();