Remove unused BlockStatus::Pending (#9447)
Pending case never instantiated, and only ever matched together with Unknown
This commit is contained in:
parent
3dbea1a7a1
commit
bc53e78a04
@ -1391,7 +1391,7 @@ impl ImportBlock for Client {
|
|||||||
bail!(BlockImportErrorKind::Import(ImportErrorKind::AlreadyInChain));
|
bail!(BlockImportErrorKind::Import(ImportErrorKind::AlreadyInChain));
|
||||||
}
|
}
|
||||||
let status = self.block_status(BlockId::Hash(unverified.parent_hash()));
|
let status = self.block_status(BlockId::Hash(unverified.parent_hash()));
|
||||||
if status == BlockStatus::Unknown || status == BlockStatus::Pending {
|
if status == BlockStatus::Unknown {
|
||||||
bail!(BlockImportErrorKind::Block(BlockError::UnknownParent(unverified.parent_hash())));
|
bail!(BlockImportErrorKind::Block(BlockError::UnknownParent(unverified.parent_hash())));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2082,7 +2082,7 @@ impl IoClient for Client {
|
|||||||
let is_parent_pending = self.queued_ancient_blocks.read().0.contains(&parent_hash);
|
let is_parent_pending = self.queued_ancient_blocks.read().0.contains(&parent_hash);
|
||||||
if !is_parent_pending {
|
if !is_parent_pending {
|
||||||
let status = self.block_status(BlockId::Hash(parent_hash));
|
let status = self.block_status(BlockId::Hash(parent_hash));
|
||||||
if status == BlockStatus::Unknown || status == BlockStatus::Pending {
|
if status == BlockStatus::Unknown {
|
||||||
bail!(BlockImportErrorKind::Block(BlockError::UnknownParent(parent_hash)));
|
bail!(BlockImportErrorKind::Block(BlockError::UnknownParent(parent_hash)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -266,7 +266,7 @@ impl BlockDownloader {
|
|||||||
BlockStatus::Bad => {
|
BlockStatus::Bad => {
|
||||||
return Err(BlockDownloaderImportError::Invalid);
|
return Err(BlockDownloaderImportError::Invalid);
|
||||||
},
|
},
|
||||||
BlockStatus::Unknown | BlockStatus::Pending => {
|
BlockStatus::Unknown => {
|
||||||
headers.push(info);
|
headers.push(info);
|
||||||
hashes.push(hash);
|
hashes.push(hash);
|
||||||
}
|
}
|
||||||
|
@ -261,7 +261,7 @@ impl SyncHandler {
|
|||||||
BlockStatus::Queued => {
|
BlockStatus::Queued => {
|
||||||
trace!(target: "sync", "New hash block already queued {:?}", hash);
|
trace!(target: "sync", "New hash block already queued {:?}", hash);
|
||||||
},
|
},
|
||||||
BlockStatus::Unknown | BlockStatus::Pending => {
|
BlockStatus::Unknown => {
|
||||||
new_hashes.push(hash.clone());
|
new_hashes.push(hash.clone());
|
||||||
if number > max_height {
|
if number > max_height {
|
||||||
trace!(target: "sync", "New unknown block hash {:?}", hash);
|
trace!(target: "sync", "New unknown block hash {:?}", hash);
|
||||||
|
@ -23,8 +23,6 @@ pub enum BlockStatus {
|
|||||||
Queued,
|
Queued,
|
||||||
/// Known as bad.
|
/// Known as bad.
|
||||||
Bad,
|
Bad,
|
||||||
/// Pending block.
|
|
||||||
Pending,
|
|
||||||
/// Unknown.
|
/// Unknown.
|
||||||
Unknown,
|
Unknown,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user