You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The sync task receives information about the block height of peers via a stream from P2P. It primarily filters out previously seen block heights and then updates a mutexed shared state with the import task. It will never generate back pressure because it can always update the state and notify import without awaiting.
flowchart LR
H{Heatbeat} --> |BlockHeight|S
S --> |height > best_height|F[stream::filter ]
F -.->|Update| ST{{State}}
F -.->|Notify| Import{Import}
Loading
Shared State:
/// State that is shared between the sync and import tasksstructState{/// The highest seen height so far.best_seen_height:Option<Height>,/// The range of heights that are currently being imported.in_flight_heights:Option<Range<Height>>,}// Empty state means we have not observed any heights and// we have not imported any headers.State{best_seen_height:None,in_flight_height:None,}// There is a new height that has been observed but not imported.State{best_seen_height:Some(5),in_flight_height:None,}// Currently importing headers 0..=5.State{best_seen_height:Some(5),in_flight_height:Some(0..=5),}// Have imported headers 0..=3 but still need to import 4..=5.State{best_seen_height:Some(5),in_flight_height:Some(3..=5),}// A newer height has been seen while the stream is importing headers.State{best_seen_height:Some(7),in_flight_height:Some(4..=5),}// All caught up with the current best seen.State{best_seen_height:Some(7),in_flight_height:Some(7..=7),}
Ports
traitP2P{/// Get a stream of block heights reported by peersasyncfnblock_heights(&self) -> BoxStream<BlockHeight>;}
The text was updated successfully, but these errors were encountered:
The sync task receives information about the block height of peers via a stream from P2P. It primarily filters out previously seen block heights and then updates a mutexed shared state with the import task. It will never generate back pressure because it can always update the state and notify import without awaiting.
Shared State:
Ports
The text was updated successfully, but these errors were encountered: