mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-31 02:31:07 +00:00
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:
commit
d70fb8a575
@ -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{};
|
||||
|
||||
@ -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.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user