Skip to content

Commit

Permalink
compare only the hash
Browse files Browse the repository at this point in the history
  • Loading branch information
shekhirin committed Oct 2, 2024
1 parent e028b70 commit 0759342
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/chain-state/src/chain_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ impl ChainInfoTracker {
/// Sets the safe header of the chain.
pub fn set_safe(&self, header: SealedHeader) {
self.inner.safe_block.send_if_modified(|current_header| {
if current_header.as_ref() != Some(&header) {
if current_header.as_ref().map(SealedHeader::hash) != Some(header.hash()) {
let _ = current_header.replace(header);
return true
}
Expand All @@ -125,7 +125,7 @@ impl ChainInfoTracker {
/// Sets the finalized header of the chain.
pub fn set_finalized(&self, header: SealedHeader) {
self.inner.finalized_block.send_if_modified(|current_header| {
if current_header.as_ref() != Some(&header) {
if current_header.as_ref().map(SealedHeader::hash) != Some(header.hash()) {
let _ = current_header.replace(header);
return true
}
Expand Down

0 comments on commit 0759342

Please sign in to comment.