chore: rename missing_parent to missing_ancestor (#3822)

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
Dan Cline
2023-07-18 10:52:09 -04:00
committed by GitHub
parent 7686371448
commit e66464b14f
3 changed files with 10 additions and 8 deletions

View File

@ -201,7 +201,7 @@ impl<DB: Database, C: Consensus, EF: ExecutorFactory> BlockchainTree<DB, C, EF>
// check if block is disconnected
if let Some(block) = self.buffered_blocks.block(block) {
return Ok(Some(BlockStatus::Disconnected { missing_parent: block.parent_num_hash() }))
return Ok(Some(BlockStatus::Disconnected { missing_ancestor: block.parent_num_hash() }))
}
Ok(None)
@ -360,7 +360,7 @@ impl<DB: Database, C: Consensus, EF: ExecutorFactory> BlockchainTree<DB, C, EF>
)
})?;
Ok(BlockStatus::Disconnected { missing_parent: lowest_ancestor.parent_num_hash() })
Ok(BlockStatus::Disconnected { missing_ancestor: lowest_ancestor.parent_num_hash() })
}
/// This tries to append the given block to the canonical chain.
@ -1274,7 +1274,7 @@ mod tests {
assert_eq!(
tree.insert_block(block2.clone()).unwrap(),
InsertPayloadOk::Inserted(BlockStatus::Disconnected {
missing_parent: block2.parent_num_hash()
missing_ancestor: block2.parent_num_hash()
})
);
@ -1293,7 +1293,7 @@ mod tests {
assert_eq!(
tree.is_block_known(block2.num_hash()).unwrap(),
Some(BlockStatus::Disconnected { missing_parent: block2.parent_num_hash() })
Some(BlockStatus::Disconnected { missing_ancestor: block2.parent_num_hash() })
);
// check if random block is known
@ -1575,7 +1575,7 @@ mod tests {
assert_eq!(
tree.insert_block(block2b.clone()).unwrap(),
InsertPayloadOk::Inserted(BlockStatus::Disconnected {
missing_parent: block2b.parent_num_hash()
missing_ancestor: block2b.parent_num_hash()
})
);

View File

@ -1262,7 +1262,9 @@ where
// block is connected to the canonical chain, but not the current head
self.try_make_sync_target_canonical(downloaded_num_hash);
}
InsertPayloadOk::Inserted(BlockStatus::Disconnected { missing_parent }) => {
InsertPayloadOk::Inserted(BlockStatus::Disconnected {
missing_ancestor: missing_parent,
}) => {
// block is not connected to the canonical head, we need to download its
// missing branch first
self.on_disconnected_block(downloaded_num_hash, missing_parent);

View File

@ -144,8 +144,8 @@ pub enum BlockStatus {
Accepted,
/// If blocks is not connected to canonical chain.
Disconnected {
/// The lowest parent block that is not connected to the canonical chain.
missing_parent: BlockNumHash,
/// The lowest ancestor block that is not connected to the canonical chain.
missing_ancestor: BlockNumHash,
},
}