refactor View to include finalized_number (#2128)

* refactor View to include finalized_number

* guide: update the NetworkBridge on BlockFinalized

* av-store: fix the tests

* actually fix tests

* grumbles

* ignore macro doctest

* use Hash::repeat_bytes more consistently

* broadcast empty leaves updates as well

* fix issuing view updates on empty leaves updates
This commit is contained in:
Andronik Ordian
2020-12-17 18:50:58 +01:00
committed by GitHub
parent 1aa2554000
commit 3f5156e866
24 changed files with 249 additions and 196 deletions
@@ -416,7 +416,7 @@ where
.filter(|(_peer, view)| {
// collect all direct interests of a peer w/o ancestors
state
.cached_live_candidates_unioned(view.0.iter())
.cached_live_candidates_unioned(view.heads.iter())
.contains_key(&candidate_hash)
})
.map(|(peer, _view)| peer.clone())
@@ -619,7 +619,7 @@ where
let _timer = metrics.time_process_incoming_peer_message();
// obtain the set of candidates we are interested in based on our current view
let live_candidates = state.cached_live_candidates_unioned(state.view.0.iter());
let live_candidates = state.cached_live_candidates_unioned(state.view.heads.iter());
// check if the candidate is of interest
let live_candidate = if let Some(live_candidate) = live_candidates.get(&message.candidate_hash) {
@@ -707,7 +707,7 @@ where
.filter(|(_peer, view)| {
// peers view must contain the candidate hash too
state
.cached_live_candidates_unioned(view.0.iter())
.cached_live_candidates_unioned(view.heads.iter())
.contains_key(&message_id.0)
})
.map(|(peer, _)| -> PeerId { peer.clone() })
@@ -781,7 +781,7 @@ impl AvailabilityDistributionSubsystem {
})) => {
// handled at view change
}
FromOverseer::Signal(OverseerSignal::BlockFinalized(_)) => {}
FromOverseer::Signal(OverseerSignal::BlockFinalized(..)) => {}
FromOverseer::Signal(OverseerSignal::Conclude) => {
return Ok(());
}