Bitcoin full node and query server

Dec 19, 2024

View in context in the libbitcoin Slack #general mirror.

evoskuil01:27
block.prepopulate() obtains all previous outputs of tx inputs within the block that are present within the block and attaches them to the .prevout metadata field of spending input. Later when the query.populate(block) is called these prevouts are skipped. This saves database search and deserialization for some number of prevouts (I will trace that value per block, it would be interesting to know). The downside is that the iteration within the block is repeated. This turns out to be a worthwhile tradeoff, as the prepopulating run is 9.7 minutes faster, or 97.5% of the no-populate run. There is very little variation across runs since this is independent of the network. So while this is a small optimization, it is one line of code that turns out to be worthwhile. I'll disable the configuration option as there is no reason to disable the behavior now that it is verified.