MapBlockIndex only grows, it never shrinks. Thereafter, it's updated whenever new blocks are received over the network. MapBlockIndex is initialized from the database in LoadBlockIndexGuts, which is run at Step 7 of startup. It is technically of type BlockMap, which is for readability. Just think of it as your blocks/ LevelDB in memory, with the key being the block hash. Since a block index is created and stored in the LevelDB when a header is received, it's possible to have block indexes in the block map without having received the full block yet, let alone having stored it to disk. This map contains all known blocks (where "block" means "block index"). multimap: an ordered map where duplicate keys are allowed (thus, can hold elements ,).set: an ordered container (think of it as a sorted linked list).map: an unordered container (think of it as a hashtable).Note: nChainTx is only stored in memory there is no corresponding entry in the database. In a sense, then, the expression (nChainTx !=0) is shorthand for a status that might be said to be "VALID_nChainTx = 3.5" - because it's more than VALID_TRANSACTIONS but less than VALID_CHAIN. Namely, VALID_TRANSACTIONS only implies that its parents are TREE, while VALID_CHAIN implies that its parents are also CHAIN. This is notable because this information is not available via the block-status enum. Thus, nChainTx > 0 is shorthand for a chain that is VALID_TRANSACTIONS. This value will be set if and only if transactions for this block and all its parents are available. nChainTx: Number of transactions in this block's chain, up to and including this block. nTx > 0 means that the block has a status of at least VALID_TRANSACTIONS. NTx: Number of transactions in this block. The precise meaning of each status code is documented in chain.h.Īlso stored in the block index are two variables worth mentioning: The block's status is one of the following: Verification status captures the degree to which the code has validated this block, as well as its ancestor blocks. One of the key traits of a block is its "verification status." The block index (block metadata) is well commented in the code: see src/chain.h. See LoadBlockIndexGuts() in src/txdb.cpp. This means the entire block tree, not just the active chain. The block index database gets loaded into memory when the node starts. 4 Disconnecting a block (reorganizations).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |