Skip to content

Commit

Permalink
Remove nested access to fields
Browse files Browse the repository at this point in the history
  • Loading branch information
MitchTurner committed Jan 25, 2024
1 parent 65d20a2 commit 09a2539
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion crates/fuel-core/src/service/adapters/p2p.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl BlockHeightImporter for BlockImporterAdapter {
Box::pin(
BroadcastStream::new(self.block_importer.subscribe())
.filter_map(|result| result.ok())
.map(|result| result.sealed_block.entity.header().consensus().height),
.map(|result| *result.sealed_block.entity.header().height()),
)
}
}
2 changes: 1 addition & 1 deletion crates/services/consensus_module/poa/src/verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ pub fn verify_block_fields<D: Database>(
);

ensure!(
header.consensus().application_hash == header.application().hash(),
header.application_hash() == &header.application().hash(),
"The application hash mismatch."
);

Expand Down
2 changes: 1 addition & 1 deletion crates/services/importer/src/importer/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ where

// We tested commit part in the `commit_result_and_execute_and_commit_poa` so setup the
// databases to always pass the committing part.
let expected_height: u32 = sealed_block.entity.header().consensus().height.into();
let expected_height: u32 = (*sealed_block.entity.header().height()).into();
let previous_height = expected_height.checked_sub(1).unwrap_or_default();
let execute_and_commit_result = execute_and_commit_assert(
sealed_block,
Expand Down
2 changes: 1 addition & 1 deletion crates/types/src/blockchain/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ impl BlockHeader {
// and can't change its final hash on the fly.
//
// This assertion is a double-checks that this behavior is not changed.
debug_assert_eq!(self.consensus().application_hash, self.application().hash());
debug_assert_eq!(self.application_hash(), &self.application().hash());
// This internally hashes the hash of the application header.
self.consensus().hash()
}
Expand Down

0 comments on commit 09a2539

Please sign in to comment.