diff --git a/lib/src/sync.rs b/lib/src/sync.rs
index bd160153cf..e1c4fef32e 100644
--- a/lib/src/sync.rs
+++ b/lib/src/sync.rs
@@ -21,13 +21,10 @@
//! > **Note**: While the above summary is a bit abstract, in practice it is almost always
//! > done by exchanging messages through a peer-to-peer network.
//!
-//! Multiple strategies exist for syncing, one for each sub-module, and which one to employ
-//! depends on the amount of information that is desired (e.g. is it required to know the header
-//! and/or body of every single block, or can some blocks be skipped?) and the distance between
-//! the highest block of the local chain and the highest block available on the remotes.
-//!
-//! The [`all`] module represents a good combination of all syncing strategies and should be the
-//! default choice for most clients.
+//! There exists multiple syncing strategies, depending on the amount of information that is.
+//! desired and the distance between the highest block of the local chain and the highest block
+//! available from the syncing sources.
+//! The [`all`] module provides a state machine that combines several syncing strategies into one.
//!
//! # Security considerations
//!
@@ -70,6 +67,5 @@
pub mod all;
pub mod all_forks;
-pub mod optimistic;
pub mod para;
pub mod warp_sync;
diff --git a/lib/src/sync/all.rs b/lib/src/sync/all.rs
index a0be364405..520a616177 100644
--- a/lib/src/sync/all.rs
+++ b/lib/src/sync/all.rs
@@ -15,10 +15,9 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-//! All syncing strategies (optimistic, warp sync, all forks) grouped together.
+//! All syncing strategies grouped together.
//!
-//! This state machine combines GrandPa warp syncing, optimistic syncing, and all forks syncing
-//! into one state machine.
+//! This state machine combines GrandPa warp syncing and all forks syncing into one state machine.
//!
//! # Overview
//!
@@ -35,7 +34,7 @@ use crate::{
executor::host,
finality::decode,
header,
- sync::{all_forks, optimistic, warp_sync},
+ sync::{all_forks, warp_sync},
trie::Nibble,
verify,
};
@@ -55,6 +54,8 @@ pub use warp_sync::{
WarpSyncFragment,
};
+use super::all_forks::AllForksSync;
+
/// Configuration for the [`AllSync`].
// TODO: review these fields
#[derive(Debug)]
@@ -203,16 +204,16 @@ impl AllSync {
)) => {
// On error, `warp_sync` returns back the chain information that was
// provided in its configuration.
- AllSyncInner::Optimistic {
- inner: optimistic::OptimisticSync::new(optimistic::Config {
- chain_information,
- block_number_bytes: config.block_number_bytes,
- sources_capacity: config.sources_capacity,
- blocks_capacity: config.blocks_capacity,
- download_ahead_blocks: config.download_ahead_blocks,
- download_bodies: false,
- }),
- }
+ AllSyncInner::AllForks(AllForksSync::new(all_forks::Config {
+ chain_information,
+ block_number_bytes: config.block_number_bytes,
+ sources_capacity: config.sources_capacity,
+ blocks_capacity: config.blocks_capacity,
+ download_bodies: false,
+ allow_unknown_consensus_engines: config.allow_unknown_consensus_engines,
+ max_disjoint_headers: config.max_disjoint_headers,
+ max_requests_per_block: config.max_requests_per_block,
+ }))
}
},
shared: Shared {
@@ -240,7 +241,6 @@ impl AllSync {
match &self.inner {
AllSyncInner::AllForks(sync) => sync.as_chain_information(),
AllSyncInner::WarpSync { inner, .. } => inner.as_chain_information(),
- AllSyncInner::Optimistic { inner } => inner.as_chain_information(),
AllSyncInner::Poisoned => unreachable!(),
}
}
@@ -276,7 +276,6 @@ impl AllSync {
finalized_block_number,
},
},
- AllSyncInner::Optimistic { .. } => Status::Sync, // TODO: right now we don't differentiate between AllForks and Optimistic, as they're kind of similar anyway
AllSyncInner::Poisoned => unreachable!(),
}
}
@@ -285,7 +284,6 @@ impl AllSync {
pub fn finalized_block_header(&self) -> header::HeaderRef {
match &self.inner {
AllSyncInner::AllForks(sync) => sync.finalized_block_header(),
- AllSyncInner::Optimistic { inner } => inner.finalized_block_header(),
AllSyncInner::WarpSync { inner, .. } => {
inner.as_chain_information().as_ref().finalized_block_header
}
@@ -300,7 +298,6 @@ impl AllSync {
pub fn best_block_header(&self) -> header::HeaderRef {
match &self.inner {
AllSyncInner::AllForks(sync) => sync.best_block_header(),
- AllSyncInner::Optimistic { inner } => inner.best_block_header(),
AllSyncInner::WarpSync { .. } => self.finalized_block_header(),
AllSyncInner::Poisoned => unreachable!(),
}
@@ -313,7 +310,6 @@ impl AllSync {
pub fn best_block_number(&self) -> u64 {
match &self.inner {
AllSyncInner::AllForks(sync) => sync.best_block_number(),
- AllSyncInner::Optimistic { inner } => inner.best_block_number(),
AllSyncInner::WarpSync { .. } => self.best_block_header().number,
AllSyncInner::Poisoned => unreachable!(),
}
@@ -326,7 +322,6 @@ impl AllSync {
pub fn best_block_hash(&self) -> [u8; 32] {
match &self.inner {
AllSyncInner::AllForks(sync) => sync.best_block_hash(),
- AllSyncInner::Optimistic { inner } => inner.best_block_hash(),
AllSyncInner::WarpSync { .. } => self
.best_block_header()
.hash(self.shared.block_number_bytes),
@@ -337,8 +332,7 @@ impl AllSync {
/// Returns consensus information about the current best block of the chain.
pub fn best_block_consensus(&self) -> chain_information::ChainInformationConsensusRef {
match &self.inner {
- AllSyncInner::AllForks(_) => todo!(), // TODO:
- AllSyncInner::Optimistic { inner } => inner.best_block_consensus(),
+ AllSyncInner::AllForks(_) => todo!(), // TODO:
AllSyncInner::WarpSync { .. } => todo!(), // TODO: ?!
AllSyncInner::Poisoned => unreachable!(),
}
@@ -352,11 +346,7 @@ impl AllSync {
let iter = sync.non_finalized_blocks_unordered();
either::Left(iter)
}
- AllSyncInner::Optimistic { inner } => {
- let iter = inner.non_finalized_blocks_unordered();
- either::Right(either::Left(iter))
- }
- AllSyncInner::WarpSync { .. } => either::Right(either::Right(iter::empty())),
+ AllSyncInner::WarpSync { .. } => either::Right(iter::empty()),
AllSyncInner::Poisoned => unreachable!(),
}
}
@@ -371,11 +361,7 @@ impl AllSync {
let iter = sync.non_finalized_blocks_ancestry_order();
either::Left(iter)
}
- AllSyncInner::Optimistic { inner } => {
- let iter = inner.non_finalized_blocks_ancestry_order();
- either::Right(either::Left(iter))
- }
- AllSyncInner::WarpSync { .. } => either::Right(either::Right(iter::empty())),
+ AllSyncInner::WarpSync { .. } => either::Right(iter::empty()),
AllSyncInner::Poisoned => unreachable!(),
}
}
@@ -387,7 +373,6 @@ impl AllSync {
pub fn is_near_head_of_chain_heuristic(&self) -> bool {
match &self.inner {
AllSyncInner::AllForks(_) => true,
- AllSyncInner::Optimistic { .. } => false,
AllSyncInner::WarpSync { .. } => false,
AllSyncInner::Poisoned => unreachable!(),
}
@@ -457,23 +442,6 @@ impl AllSync {
self.inner = AllSyncInner::AllForks(all_forks);
outer_source_id
}
- AllSyncInner::Optimistic { mut inner } => {
- let outer_source_id_entry = self.shared.sources.vacant_entry();
- let outer_source_id = SourceId(outer_source_id_entry.key());
-
- let source_id = inner.add_source(
- OptimisticSourceExtra {
- user_data,
- outer_source_id,
- best_block_hash,
- },
- best_block_number,
- );
- outer_source_id_entry.insert(SourceMapping::Optimistic(source_id));
-
- self.inner = AllSyncInner::Optimistic { inner };
- outer_source_id
- }
AllSyncInner::Poisoned => unreachable!(),
}
}
@@ -522,33 +490,6 @@ impl AllSync {
(user_data.user_data, requests)
}
- (AllSyncInner::Optimistic { inner }, SourceMapping::Optimistic(source_id)) => {
- let (user_data, requests) = inner.remove_source(source_id);
- // TODO: do properly
- let self_requests = &mut self.shared.requests;
- let requests = requests
- .map(move |(_inner_request_id, request_inner_user_data)| {
- debug_assert!(
- self_requests.contains(request_inner_user_data.outer_request_id.0)
- );
- let _removed =
- self_requests.remove(request_inner_user_data.outer_request_id.0);
- debug_assert!(matches!(
- _removed,
- RequestMapping::Optimistic(_inner_request_id)
- ));
- (
- request_inner_user_data.outer_request_id,
- request_inner_user_data.user_data,
- )
- })
- .collect::>()
- .into_iter();
-
- // TODO: also handle the "inline" requests
-
- (user_data.user_data, requests)
- }
(AllSyncInner::WarpSync { inner, .. }, SourceMapping::WarpSync(source_id)) => {
let (user_data, requests) = inner.remove_source(source_id);
@@ -586,10 +527,6 @@ impl AllSync {
// other.
(AllSyncInner::WarpSync { .. }, SourceMapping::AllForks(_)) => unreachable!(),
(AllSyncInner::AllForks(_), SourceMapping::WarpSync(_)) => unreachable!(),
- (AllSyncInner::Optimistic { .. }, SourceMapping::AllForks(_)) => unreachable!(),
- (AllSyncInner::AllForks(_), SourceMapping::Optimistic(_)) => unreachable!(),
- (AllSyncInner::WarpSync { .. }, SourceMapping::Optimistic(_)) => unreachable!(),
- (AllSyncInner::Optimistic { .. }, SourceMapping::WarpSync(_)) => unreachable!(),
}
}
@@ -600,13 +537,9 @@ impl AllSync {
let iter = inner.sources().map(move |id| inner[id].outer_source_id);
either::Left(iter)
}
- AllSyncInner::Optimistic { inner: sync } => {
- let iter = sync.sources().map(move |id| sync[id].outer_source_id);
- either::Right(either::Left(iter))
- }
AllSyncInner::AllForks(sync) => {
let iter = sync.sources().map(move |id| sync[id].outer_source_id);
- either::Right(either::Right(iter))
+ either::Right(iter)
}
AllSyncInner::Poisoned => unreachable!(),
}
@@ -633,9 +566,6 @@ impl AllSync {
(AllSyncInner::AllForks(sync), SourceMapping::AllForks(src)) => {
sync.source_num_ongoing_requests(*src)
}
- (AllSyncInner::Optimistic { inner }, SourceMapping::Optimistic(src)) => {
- inner.source_num_ongoing_requests(*src)
- }
(AllSyncInner::WarpSync { inner, .. }, SourceMapping::WarpSync(src)) => {
inner.source_num_ongoing_requests(*src)
}
@@ -646,10 +576,6 @@ impl AllSync {
// other.
(AllSyncInner::WarpSync { .. }, SourceMapping::AllForks(_)) => unreachable!(),
(AllSyncInner::AllForks(_), SourceMapping::WarpSync(_)) => unreachable!(),
- (AllSyncInner::Optimistic { .. }, SourceMapping::AllForks(_)) => unreachable!(),
- (AllSyncInner::AllForks(_), SourceMapping::Optimistic(_)) => unreachable!(),
- (AllSyncInner::WarpSync { .. }, SourceMapping::Optimistic(_)) => unreachable!(),
- (AllSyncInner::Optimistic { .. }, SourceMapping::WarpSync(_)) => unreachable!(),
};
num_inline + num_inner
@@ -670,11 +596,6 @@ impl AllSync {
(AllSyncInner::AllForks(sync), SourceMapping::AllForks(src)) => {
sync.source_best_block(*src)
}
- (AllSyncInner::Optimistic { inner }, SourceMapping::Optimistic(src)) => {
- let height = inner.source_best_block(*src);
- let hash = &inner[*src].best_block_hash;
- (height, hash)
- }
(AllSyncInner::WarpSync { inner, .. }, SourceMapping::WarpSync(src)) => {
let ud = &inner[*src];
(ud.best_block_number, &ud.best_block_hash)
@@ -686,10 +607,6 @@ impl AllSync {
// other.
(AllSyncInner::WarpSync { .. }, SourceMapping::AllForks(_)) => unreachable!(),
(AllSyncInner::AllForks(_), SourceMapping::WarpSync(_)) => unreachable!(),
- (AllSyncInner::Optimistic { .. }, SourceMapping::AllForks(_)) => unreachable!(),
- (AllSyncInner::AllForks(_), SourceMapping::Optimistic(_)) => unreachable!(),
- (AllSyncInner::WarpSync { .. }, SourceMapping::Optimistic(_)) => unreachable!(),
- (AllSyncInner::Optimistic { .. }, SourceMapping::WarpSync(_)) => unreachable!(),
}
}
@@ -715,10 +632,6 @@ impl AllSync {
(AllSyncInner::AllForks(sync), SourceMapping::AllForks(src)) => {
sync.source_knows_non_finalized_block(*src, height, hash)
}
- (AllSyncInner::Optimistic { inner }, SourceMapping::Optimistic(src)) => {
- // TODO: is this correct?
- inner.source_best_block(*src) >= height
- }
(AllSyncInner::WarpSync { inner, .. }, SourceMapping::WarpSync(src)) => {
assert!(
height
@@ -739,10 +652,6 @@ impl AllSync {
// other.
(AllSyncInner::WarpSync { .. }, SourceMapping::AllForks(_)) => unreachable!(),
(AllSyncInner::AllForks(_), SourceMapping::WarpSync(_)) => unreachable!(),
- (AllSyncInner::Optimistic { .. }, SourceMapping::AllForks(_)) => unreachable!(),
- (AllSyncInner::AllForks(_), SourceMapping::Optimistic(_)) => unreachable!(),
- (AllSyncInner::WarpSync { .. }, SourceMapping::Optimistic(_)) => unreachable!(),
- (AllSyncInner::Optimistic { .. }, SourceMapping::WarpSync(_)) => unreachable!(),
}
}
@@ -786,15 +695,7 @@ impl AllSync {
let iter = sync
.knows_non_finalized_block(height, hash)
.map(move |id| sync[id].outer_source_id);
- either::Left(either::Left(iter))
- }
- AllSyncInner::Optimistic { inner } => {
- // TODO: is this correct?
- let iter = inner
- .sources()
- .filter(move |source_id| inner.source_best_block(*source_id) >= height)
- .map(move |source_id| inner[source_id].outer_source_id);
- either::Left(either::Right(iter))
+ either::Left(iter)
}
AllSyncInner::Poisoned => unreachable!(),
}
@@ -850,17 +751,6 @@ impl AllSync {
},
);
- either::Left(either::Right(iter))
- }
- AllSyncInner::Optimistic { inner } => {
- let iter = inner.desired_requests().map(move |rq_detail| {
- (
- inner[rq_detail.source_id].outer_source_id,
- &inner[rq_detail.source_id].user_data,
- optimistic_request_convert(rq_detail, self.shared.download_bodies),
- )
- });
-
either::Right(iter)
}
AllSyncInner::WarpSync { inner, .. } => {
@@ -913,7 +803,7 @@ impl AllSync {
)
});
- either::Left(either::Left(iter))
+ either::Left(iter)
}
AllSyncInner::Poisoned => unreachable!(),
}
@@ -969,39 +859,6 @@ impl AllSync {
request_mapping_entry.insert(RequestMapping::AllForks(inner_request_id));
return outer_request_id;
}
- (
- AllSyncInner::Optimistic { inner },
- RequestDetail::BlocksRequest {
- ascending: true, // TODO: ?
- first_block_height,
- num_blocks,
- ..
- },
- ) => {
- let inner_source_id = match self.shared.sources.get(source_id.0).unwrap() {
- SourceMapping::Optimistic(inner_source_id) => *inner_source_id,
- _ => unreachable!(),
- };
-
- let request_mapping_entry = self.shared.requests.vacant_entry();
- let outer_request_id = RequestId(request_mapping_entry.key());
-
- let inner_request_id = inner.insert_request(
- optimistic::RequestDetail {
- source_id: inner_source_id,
- block_height: NonZeroU64::new(*first_block_height).unwrap(), // TODO: correct to unwrap?
- num_blocks: NonZeroU32::new(u32::try_from(num_blocks.get()).unwrap())
- .unwrap(), // TODO: don't unwrap
- },
- OptimisticRequestExtra {
- outer_request_id,
- user_data,
- },
- );
-
- request_mapping_entry.insert(RequestMapping::Optimistic(inner_request_id));
- return outer_request_id;
- }
(
AllSyncInner::WarpSync { inner, .. },
RequestDetail::WarpSync {
@@ -1122,7 +979,6 @@ impl AllSync {
return outer_request_id;
}
(AllSyncInner::AllForks { .. }, _) => {}
- (AllSyncInner::Optimistic { .. }, _) => {}
(AllSyncInner::WarpSync { .. }, _) => {}
(AllSyncInner::Poisoned, _) => unreachable!(),
}
@@ -1157,20 +1013,7 @@ impl AllSync {
);
either::Left(iter)
}
- AllSyncInner::Optimistic { inner } => {
- let iter = inner
- .obsolete_requests()
- .map(move |(_, rq)| rq.outer_request_id)
- .chain(
- self.shared
- .requests
- .iter()
- .filter(|(_, rq)| matches!(rq, RequestMapping::Inline(..)))
- .map(|(id, _)| RequestId(id)),
- );
- either::Right(either::Left(iter))
- }
- AllSyncInner::WarpSync { .. } => either::Right(either::Right(iter::empty())), // TODO: not implemented properly
+ AllSyncInner::WarpSync { .. } => either::Right(iter::empty()), // TODO: not implemented properly
AllSyncInner::Poisoned => unreachable!(),
}
}
@@ -1186,9 +1029,6 @@ impl AllSync {
(AllSyncInner::AllForks(inner), RequestMapping::AllForks(rq)) => {
inner[inner.request_source_id(*rq)].outer_source_id
}
- (AllSyncInner::Optimistic { inner }, RequestMapping::Optimistic(rq)) => {
- inner[inner.request_source_id(*rq)].outer_source_id
- }
(AllSyncInner::WarpSync { inner, .. }, RequestMapping::WarpSync(rq)) => {
inner[inner.request_source_id(*rq)].outer_source_id
}
@@ -1281,24 +1121,6 @@ impl AllSync {
})
}
},
- AllSyncInner::Optimistic { inner } => match inner.process_one() {
- optimistic::ProcessOne::Idle { sync } => {
- self.inner = AllSyncInner::Optimistic { inner: sync };
- ProcessOne::AllSync(self)
- }
- optimistic::ProcessOne::VerifyBlock(inner) => {
- ProcessOne::VerifyBlock(BlockVerify {
- inner: BlockVerifyInner::Optimistic(inner),
- shared: self.shared,
- })
- }
- optimistic::ProcessOne::VerifyJustification(inner) => {
- ProcessOne::VerifyFinalityProof(FinalityProofVerify {
- inner: FinalityProofVerifyInner::Optimistic(inner),
- shared: self.shared,
- })
- }
- },
AllSyncInner::Poisoned => unreachable!(),
}
}
@@ -1336,21 +1158,6 @@ impl AllSync {
}
}
}
- (AllSyncInner::Optimistic { inner }, &SourceMapping::Optimistic(source_id)) => {
- match header::decode(&announced_scale_encoded_header, inner.block_number_bytes()) {
- Ok(header) => {
- if is_best {
- inner.raise_source_best_block(source_id, header.number);
- inner[source_id].best_block_hash =
- header::hash_from_scale_encoded_header(
- &announced_scale_encoded_header,
- );
- }
- BlockAnnounceOutcome::Discarded
- }
- Err(err) => BlockAnnounceOutcome::InvalidHeader(err),
- }
- }
(AllSyncInner::WarpSync { inner, .. }, &SourceMapping::WarpSync(source_id)) => {
match header::decode(
&announced_scale_encoded_header,
@@ -1378,10 +1185,6 @@ impl AllSync {
// other.
(AllSyncInner::WarpSync { .. }, SourceMapping::AllForks(_)) => unreachable!(),
(AllSyncInner::AllForks(_), SourceMapping::WarpSync(_)) => unreachable!(),
- (AllSyncInner::Optimistic { .. }, SourceMapping::AllForks(_)) => unreachable!(),
- (AllSyncInner::AllForks(_), SourceMapping::Optimistic(_)) => unreachable!(),
- (AllSyncInner::WarpSync { .. }, SourceMapping::Optimistic(_)) => unreachable!(),
- (AllSyncInner::Optimistic { .. }, SourceMapping::WarpSync(_)) => unreachable!(),
}
}
@@ -1402,7 +1205,6 @@ impl AllSync {
(AllSyncInner::AllForks(sync), SourceMapping::AllForks(source_id)) => {
sync.update_source_finality_state(*source_id, finalized_block_height)
}
- (AllSyncInner::Optimistic { .. }, _) => {} // TODO: the optimistic sync could get some help from the finalized block
(AllSyncInner::WarpSync { inner, .. }, SourceMapping::WarpSync(source_id)) => {
inner.set_source_finality_state(*source_id, finalized_block_height);
}
@@ -1448,7 +1250,6 @@ impl AllSync {
inner.set_source_finality_state(*source_id, block_number);
GrandpaCommitMessageOutcome::Discarded
}
- (AllSyncInner::Optimistic { .. }, _) => GrandpaCommitMessageOutcome::Discarded,
// Invalid internal states.
(AllSyncInner::AllForks(_), _) => unreachable!(),
@@ -1577,41 +1378,6 @@ impl AllSync {
debug_assert_eq!(request_user_data.outer_request_id, request_id);
(request_user_data.user_data.unwrap(), outcome)
}
- (AllSyncInner::Optimistic { inner }, RequestMapping::Optimistic(inner_request_id)) => {
- let (request_user_data, outcome) = if let Ok(blocks) = blocks {
- let (request_user_data, outcome) = inner.finish_request_success(
- inner_request_id,
- blocks.map(|block| optimistic::RequestSuccessBlock {
- scale_encoded_header: block.scale_encoded_header,
- scale_encoded_justifications: block
- .scale_encoded_justifications
- .into_iter()
- .map(|j| (j.engine_id, j.justification))
- .collect(),
- scale_encoded_extrinsics: block.scale_encoded_extrinsics,
- user_data: block.user_data,
- }),
- );
-
- match outcome {
- optimistic::FinishRequestOutcome::Obsolete => {
- (request_user_data, ResponseOutcome::Outdated)
- }
- optimistic::FinishRequestOutcome::Queued => {
- (request_user_data, ResponseOutcome::Queued)
- }
- }
- } else {
- // TODO: `ResponseOutcome::Queued` is a hack
- (
- inner.finish_request_failed(inner_request_id),
- ResponseOutcome::Queued,
- )
- };
-
- debug_assert_eq!(request_user_data.outer_request_id, request_id);
- (request_user_data.user_data, outcome)
- }
_ => unreachable!(),
}
}
@@ -1814,9 +1580,6 @@ impl ops::Index for AllSync {
debug_assert!(self.shared.sources.contains(source_id.0));
match (&self.inner, self.shared.sources.get(source_id.0).unwrap()) {
(AllSyncInner::AllForks(sync), SourceMapping::AllForks(src)) => &sync[*src].user_data,
- (AllSyncInner::Optimistic { inner }, SourceMapping::Optimistic(src)) => {
- &inner[*src].user_data
- }
(AllSyncInner::WarpSync { inner, .. }, SourceMapping::WarpSync(src)) => {
&inner[*src].user_data
}
@@ -1827,10 +1590,6 @@ impl ops::Index for AllSync {
// other.
(AllSyncInner::WarpSync { .. }, SourceMapping::AllForks(_)) => unreachable!(),
(AllSyncInner::AllForks(_), SourceMapping::WarpSync(_)) => unreachable!(),
- (AllSyncInner::Optimistic { .. }, SourceMapping::AllForks(_)) => unreachable!(),
- (AllSyncInner::AllForks(_), SourceMapping::Optimistic(_)) => unreachable!(),
- (AllSyncInner::WarpSync { .. }, SourceMapping::Optimistic(_)) => unreachable!(),
- (AllSyncInner::Optimistic { .. }, SourceMapping::WarpSync(_)) => unreachable!(),
}
}
}
@@ -1846,9 +1605,6 @@ impl ops::IndexMut for AllSync {
(AllSyncInner::AllForks(sync), SourceMapping::AllForks(src)) => {
&mut sync[*src].user_data
}
- (AllSyncInner::Optimistic { inner }, SourceMapping::Optimistic(src)) => {
- &mut inner[*src].user_data
- }
(AllSyncInner::WarpSync { inner, .. }, SourceMapping::WarpSync(src)) => {
&mut inner[*src].user_data
}
@@ -1859,10 +1615,6 @@ impl ops::IndexMut for AllSync {
// other.
(AllSyncInner::WarpSync { .. }, SourceMapping::AllForks(_)) => unreachable!(),
(AllSyncInner::AllForks(_), SourceMapping::WarpSync(_)) => unreachable!(),
- (AllSyncInner::Optimistic { .. }, SourceMapping::AllForks(_)) => unreachable!(),
- (AllSyncInner::AllForks(_), SourceMapping::Optimistic(_)) => unreachable!(),
- (AllSyncInner::WarpSync { .. }, SourceMapping::Optimistic(_)) => unreachable!(),
- (AllSyncInner::Optimistic { .. }, SourceMapping::WarpSync(_)) => unreachable!(),
}
}
}
@@ -1874,7 +1626,6 @@ impl<'a, TRq, TSrc, TBl> ops::Index<(u64, &'a [u8; 32])> for AllSync &TBl {
match &self.inner {
AllSyncInner::AllForks(inner) => inner[(block_height, block_hash)].as_ref().unwrap(),
- AllSyncInner::Optimistic { inner, .. } => &inner[block_hash],
AllSyncInner::WarpSync { .. } => panic!("unknown block"), // No block is ever stored during the warp syncing.
AllSyncInner::Poisoned => unreachable!(),
}
@@ -1886,7 +1637,6 @@ impl<'a, TRq, TSrc, TBl> ops::IndexMut<(u64, &'a [u8; 32])> for AllSync &mut TBl {
match &mut self.inner {
AllSyncInner::AllForks(inner) => inner[(block_height, block_hash)].as_mut().unwrap(),
- AllSyncInner::Optimistic { inner, .. } => &mut inner[block_hash],
AllSyncInner::WarpSync { .. } => panic!("unknown block"), // No block is ever stored during the warp syncing.
AllSyncInner::Poisoned => unreachable!(),
}
@@ -2224,9 +1974,6 @@ enum BlockVerifyInner {
AllForks(
all_forks::BlockVerify