Refine the BF logic for updating the PeerFetchState with async block adds #1845
Labels
block-fetch
Issues related to block fetch component.
bug
Something isn't working
consensus
issues related to ouroboros-consensus
Milestone
While developing a new approach to the
ThreadNet
tests, I noticed something unexpected in the BlockFetch threads'Tracer
output.As of PR #1709, the BF client adds blocks to CDB asynchronously instead of synchronously. Since the
addFetchedBlock
call in the BF client now returns immediately, the BF client now updates itsPeerFetchStatus
(to indicate the fetched block is no-longer in flight) before the CDB updates its current chain (to include the new fetched block) (or is itChainDB.getIsFetched
and not the current chain?).As a result I'm seeing the node's BF fetch logic thread immediately add a duplicate fetch request for the same block. Once the BF client updates its peer status, the relevant inputs to the fetch logic thread now look the same as they did before it originally made the fetch request: the (fetched) block is not in flight and it is not in the CDB's current chain -- it's about to be, but the fetch logic doesn't know that.
This is causing the BF client in the
ThreadNet
to fetch every (?) block twice. This Issue is resolved when the the BF client no longer causes the node's fetch logic thread to repeat its requests.@duncan shared some thoughts here https://input-output-rnd.slack.com/archives/GCW2S19CM/p1585076440303700
The text was updated successfully, but these errors were encountered: