Bitcoin full node and query server

Jun 30, 2021

View in context in the libbitcoin Slack #general mirror.

evoskuil19:40
Hi Phil, If you are looking at header sync, you are in v4. In v4 the process is as follows. First, the structure: The block table retains headers (a bit of a misnomer), the tx table retains txs. There is an association table that retains the associations between headers and their downloaded transactions. The purpose of the association is to allow headers (before obtaining txs) to be stored in an array-table, as the association to txs is fixed-width. There are two height indexes, one for the confirmed chain and one for a candidate chain. The confirmed index is authoritative for the strong branch. The candidate index is the next-strongest visible branch. There are arrays of pointers to block headers, allowing blocks to be queried by height in constant time. There is also a payments index. This provides constant time query from any output script to the transactions that contains it (outputs) and any that reference it (inputs). The indexes are redundant information. The entire chain is retained by the three headers->transactions tables. Headers can exist without associated transactions, and transactions can exist without associating headers. Transactions can be associated by any number of headers. All associations are complete (full block or none)...
8 replies · Phil, evoskuil · last Aug 11, 2021
P
Phil18:06
Please define exactly what you mean by ‘visible branch’?
P
Phil19:02
What do you mean, for there to be an association between one block header and one transaction (and associations are by nature bidirectional), the whole block structure for the said block must be represented in persistence i.e. either ALL or NONE of the transactions belonging to one block are in the persistence?
evoskuil04:30
Branch the node sees.
evoskuil04:33
If the block is “populated” then all of its transactions are stored and linked from the header by the association table. A block header will first be stored without being populated, though any number of its transactions may be stored at any time.
(edited)
evoskuil04:34
A block must be populated before being validated and validated before being confirmed. Transactions arrive from the tx pool and from other blocks, which may be in another branch and therefore have some of the same txs.
evoskuil04:36
The associations are not bidirectionally traversible. But each transaction carries its confirmation height, so confirmed txs can be traversed to their header.
evoskuil04:36
Unconfirmed txs are presumed to not have height.
evoskuil04:37
This includes those in weak branch blocks