Bitcoin Forum
April 24, 2024, 09:19:42 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
  Home Help Search Login Register More  
  Show Posts
Pages: [1]
1  Bitcoin / Development & Technical Discussion / Where/how is on disk/network block size determined and stored? on: November 03, 2017, 05:28:48 PM
Searching google and the forums for this answer mostly matches block size debate questions, which is not what I'm after.

When a block is transmitted across the network or stored on disk:

1. Where is the size of the actual block stored in the message? Do you just send a TCP message ahead of the block that says "hey, the next block is 875,489 bytes long!" or is it encoded somewhere in to the block structure itself (apparently it isn't in the block header)?
2. Similarly, on disk, where is the record of how big each block is (so the filesystem knows how much data to read)? Is that in the chain state database, or it is stored in the BLK*.dat files themselves? Or somewhere else?

Basically, I'm trying to understand, from a systems programming perspective, how you tell the storage/TCP layers how much data to read and write from/to disk/network.
Pages: [1]
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!