50 | @@ -51,7 +51,7 @@ class BlockFilterIndex final : public BaseIndex
51 |
52 | Mutex m_cs_headers_cache;
53 | /** cache of block hash to filter header, to avoid disk access when responding to getcfcheckpt. */
54 | - std::unordered_map<uint256, uint256, FilterHeaderHasher> m_headers_cache GUARDED_BY(m_cs_headers_cache);
55 | + std::unordered_map<uint256, uint256, Uint256Hasher> m_headers_cache GUARDED_BY(m_cs_headers_cache);
But, this is a map of block hash -> filter header. The key is a block hash, so wouldn't just replacing this with the existing BlockHasher be a more appropriate fix?
I think the name would be BlockHashHasher, which felt strange but I am impartial to the naming here. I went with Uint256Hasher as it was more general.
I went with Uint256Hasher as it was more general.
I think it is not really a general uint256 hasher. The assumption is that the uint256 is a block hash with pow (or derived from a block hash). Otherwise, it seems risky to use without salt. So i think putting "block" somewhere in the name makes sense. Otherwise, it is easier to mis-use.
I see, makes sense. Updated 454b213f8890658d39be86804550e8ddba9b7364
Why not instead rename the existing BlockHasher to BlockHashHasher and remove this hasher specific to filter headers?
so wouldn't just replacing this with the existing BlockHasher be a more appropriate fix?
Sorry, I overlooked the word "existing" in the review above and did not parse the file very carefully. Yes, makes sense.
Updated ccf9172ab3bbd6d6979acb9b02bc36ca55ab031f