mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore: rename missing_parent to missing_ancestor (#3822)
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
@ -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()
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user