Merge bitcoin/bitcoin#34351: util: Remove FilterHeaderHasher

ccf9172ab3bbd6d6979acb9b02bc36ca55ab031f util: Remove `FilterHeaderHasher` (rustaceanrob)

Pull request description:

  With respect to `std::unordered_map` documentation, the `Hash` type
  defined in the template is over the `Key` and not `T`, the value. This
  hasher is incorrectly named as the `FilterHeader` is the value within this map.
  I consider this a bug as opposed to a refactor as the key and value
  relationship is implied to be `filter header -> block hash` when it is
  the opposite.

  Further, the hasher for the key already exists via `BlockHasher`.

  ref: https://en.cppreference.com/w/cpp/container/unordered_map.html

ACKs for top commit:
  andrewtoth:
    ACK ccf9172ab3bbd6d6979acb9b02bc36ca55ab031f
  maflcko:
    lgtm ACK ccf9172ab3bbd6d6979acb9b02bc36ca55ab031f
  ismaelsadeeq:
    ACK ccf9172ab3bbd6d6979acb9b02bc36ca55ab031f 👍🏾

Tree-SHA512: 607602391bf337d4e25b04a6a643fa32c3ab4599009b181b46ecdb0705e8ff2af89a6192042453c9e8e44abcb2150589019f02c5c944ecdff41322c3e0ad45ac
This commit is contained in:
merge-script 2026-01-26 10:17:35 +00:00
commit d70fb8a575
No known key found for this signature in database
GPG Key ID: 2EEB9F5CC09526C1
2 changed files with 1 additions and 5 deletions

View File

@ -51,7 +51,7 @@ private:
Mutex m_cs_headers_cache;
/** cache of block hash to filter header, to avoid disk access when responding to getcfcheckpt. */
std::unordered_map<uint256, uint256, FilterHeaderHasher> m_headers_cache GUARDED_BY(m_cs_headers_cache);
std::unordered_map<uint256, uint256, BlockHasher> m_headers_cache GUARDED_BY(m_cs_headers_cache);
// Last computed header to avoid disk reads on every new block.
uint256 m_last_header{};

View File

@ -76,10 +76,6 @@ public:
}
};
struct FilterHeaderHasher {
size_t operator()(const uint256& hash) const { return ReadLE64(hash.begin()); }
};
/**
* We're hashing a nonce into the entries themselves, so we don't need extra
* blinding in the set hash computation.