From f5cb6981c7a8e911c7bc164b380ba7e5a8feb2cb Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Tue, 23 May 2023 15:53:17 +0200 Subject: [PATCH] chore: remove redundant parent arg (#2796) --- crates/blockchain-tree/src/blockchain_tree.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/blockchain-tree/src/blockchain_tree.rs b/crates/blockchain-tree/src/blockchain_tree.rs index 0279e23f6d..6fe0340370 100644 --- a/crates/blockchain-tree/src/blockchain_tree.rs +++ b/crates/blockchain-tree/src/blockchain_tree.rs @@ -291,7 +291,7 @@ impl BlockchainTree .is_block_hash_canonical(&parent.hash) .map_err(|err| InsertBlockError::new(block.block.clone(), err.into()))? { - return self.try_append_canonical_chain(block, parent) + return self.try_append_canonical_chain(block) } // this is another check to ensure that if the block points to a canonical block its block @@ -326,15 +326,15 @@ impl BlockchainTree /// This tries to append the given block to the canonical chain. /// - /// WARNING: this expects that the block is part of the canonical chain, see - /// [Self::is_block_hash_canonical]. Hence, it is expected that the block can be traced back - /// to the current canonical block. + /// WARNING: this expects that the block is part of the canonical chain: The block's parent is + /// part of the canonical chain (e.g. the block's parent is the latest canonical hash). See also + /// [Self::is_block_hash_canonical]. #[instrument(skip_all, target = "blockchain_tree")] fn try_append_canonical_chain( &mut self, block: SealedBlockWithSenders, - parent: BlockNumHash, ) -> Result { + let parent = block.parent_num_hash(); let block_num_hash = block.num_hash(); debug!(target: "blockchain_tree", head = ?block_num_hash.hash, ?parent, "Appending block to canonical chain"); // create new chain that points to that block