Block and reverse patches are currently stored in .dat files, and in each .dat file there are several blocks or reverse patches. What is the reason why blocks are not stored in individual files called, for example, [block_hash].blk and [block_hash].rev and are instead stored in this way?
Asked
Active
Viewed 42 times
1 Answers
1
No file systems handle large numbers of files well, putting 600,000+ files in a directory would cause absurd performance problems. Opening and closing that many files during sync would have a performance penalty, versus appending to an already open file and writing its position to an index. Even attempting to delete a folder that large would be a struggle.
A reason the block files are as small as they are is due to limitations in windows file systems that have restrictive legacy compatibility.
Claris
- 15,323
- 2
- 26
- 43
-
3No, the reason for the block files' small size is so that pruning has reasonable granularity. – Pieter Wuille Nov 03 '20 at 17:44
-
It predates pruning though. – Claris Nov 03 '20 at 17:44
-
2I'm aware, but I wrote it with pruning in mind. – Pieter Wuille Nov 03 '20 at 17:45