You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge #6851: refactor: introduce new helpers Uint256HashMap, Uint256HashSet, Uint256LruHashMap
c461dcc fix: review comments (Konstantin Akimov)
46a28e6 fmt: apply clang-format (Konstantin Akimov)
c452f88 refactor: leftover usages that has not been replaced by automatic script (Konstantin Akimov)
85e6af4 refactor: use Uint256LruHashMap all overcodebase (Konstantin Akimov)
c8c6d29 refactor: use Uint256HashMap all over codebase (Konstantin Akimov)
3aaf330 refactor: use Uint256HashSet all over codebase (Konstantin Akimov)
d7cd9ab refactor: define helpers Uint256HashMap, Uint256HashSet, Uint256LruHashMap for code simplification (Konstantin Akimov)
Pull request description:
## Issue being fixed or feature implemented
Instead typing `std::unordered_map<uint256, CDeterministicMNList, StaticSaltedHasher> mnListsCache` better to just write `Uint256HashMap<CDeterministicMNList> mnListsCache` to minimize a boiler code. This PR aims to replace #6839, but this PR reduces scope significantly, no extra header is introduced.
## What was done?
Main idea is authored by kwvg's PR:
template <typename T>
using Uint256HashMap = std::unordered_map<uint256, T, StaticSaltedHasher>;
These helpers are used to prepare a PR:
find src/ -name '*.cpp' -exec sed -i 's/std::unordered_set<uint256, StaticSaltedHasher>/Uint256HashSet/' {} \;
find src/ -name '*.cpp' -exec sed -i 's/std::unordered_map<uint256, \([a-zA-Z0-9:]*\), StaticSaltedHasher>/Uint256HashMap<\1>/' {} \;
find src/ -name '*.cpp' -exec sed -i 's/unordered_lru_cache<uint256, \([a-zA-Z0-9:]*\), StaticSaltedHasher>/Uint256LruHashMap<\1>/' {} \;
Leftover changes are done manually.
Please, note, that compilation time is not affected by including `<unordered_set>` and `<unordered_map>` because they are already included indirectly by chain `<saltedhasher.h> -> <hash.h> -> <serialize.h>`
## How Has This Been Tested?
Grep all over codebase by `StaticSaltedHasher`
## Breaking Changes
N/A
## Checklist:
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have added or updated relevant unit/integration/functional/e2e tests
- [ ] I have made corresponding changes to the documentation
- [x] I have assigned this pull request to a milestone
ACKs for top commit:
kwvg:
utACK c461dcc
Tree-SHA512: 2d8d0722554f5f89102d4d5380bfda01f2214cf8da82dbf300753e373a0b78ef6248ca626bd07f5bb467c5670ae9733d34aa020a1d268d3074dbc77fc5fc953b
0 commit comments