Skip to content

Commit

Permalink
Assert acount hash mmap file capacity > 0 (#33575)
Browse files Browse the repository at this point in the history
assert mmap capacity > 0

Co-authored-by: HaoranYi <[email protected]>
  • Loading branch information
HaoranYi and HaoranYi authored Oct 9, 2023
1 parent 46cf79a commit 72574da
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions accounts-db/src/accounts_hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 72574da

Please sign in to comment.