Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

blockchain: Cache tip and parent at init. #1100

Merged

Conversation

davecgh
Copy link
Member

@davecgh davecgh commented Mar 1, 2018

This modifies the startup logic to cache the tip and parent blocks in the main chain block cache at initialization time which is desirable because all of the transactions which come in to the mempool need access to the these blocks to construct their utxo views due to the potential for invalidation of the outputs in the previous block through voting.

Without caching them, the blocks end up being loaded from the database again every time a new transaction enters the mempool until the blocks eventually get cached when a new block is connected which is majorly inefficient.

This modifies the startup logic to cache the tip and parent blocks in
the main chain block cache at initialization time which is desirable
because all of the transactions which come in to the mempool need access
to the these blocks to construct their utxo views due to the potential
for invalidation of the outputs in the previous block through voting.

Without caching them, the blocks end up being loaded from the database
again every time a new transaction enters the mempool until the blocks
eventually get cached when a new block is connected which is majorly
inefficient.
@davecgh davecgh force-pushed the blockchain_cache_tip_and_parent_at_init branch from 8ac3fb0 to c9cfd21 Compare March 1, 2018 18:05
Copy link
Member

@dajohi dajohi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@davecgh davecgh merged commit c9cfd21 into decred:master Mar 1, 2018
@davecgh davecgh deleted the blockchain_cache_tip_and_parent_at_init branch March 1, 2018 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants