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

BlockFetchConsensusInterface.readFetchedBlocks: report blocks as fetched as soon as they are enqueued #952

Open
amesgen opened this issue Feb 14, 2024 · 0 comments

Comments

@amesgen
Copy link
Member

amesgen commented Feb 14, 2024

Currently, the readFetchedBlocks from BlockFetchConsensusInterface we provide to Network is implemented via ChainDB.getIsFetched (which in turn is implemented via VolatileDB.getIsMember). When a new block is added from a BlockFetch client, it might therefore take a bit of time until the block has been written to disk, and is hence reported as fetched by readFetchedBlocks.1

This might occasionally lead the BlockFetch decision logic to unnecessarily request the block from another peer, even though it has already been downloaded, just not yet written to disk.

I implemented an ad-hoc fix for this (also reporting blocks in the queue as fetched) here: main...amesgen/getIsFetched-bg-queue
@karknu tested this change, and observed that it fixes the behavior described above.

It would be nice to validate and clean-up this patch.

Footnotes

  1. This is the (weaker) requirement that is currently stated on mkAddFetchedBlock:

    Upon successful completion of addFetchedBlock it must be the case that readFetchedBlocks reports the block.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🔖 Ready
Development

No branches or pull requests

1 participant