![]() |
Bitcoin Core
0.21.1
P2P Digital Currency
|
#include <coins.h>
Public Member Functions | |
| SaltedOutpointHasher () | |
| size_t | operator() (const COutPoint &id) const noexcept |
| This must return size_t. More... | |
Private Attributes | |
| const uint64_t | k0 |
| Salt. More... | |
| const uint64_t | k1 |
|
inlinenoexcept |
This must return size_t.
With Boost 1.46 on 32-bit systems the unordered_map will behave unpredictably if the custom hasher returns a uint64_t, resulting in failures when syncing the chain (#4634).
Having the hash noexcept allows libstdc++'s unordered_map to recalculate the hash during rehash, so it does not have to cache the value. This reduces node's memory by sizeof(size_t). The required recalculation has a slight performance penalty (around 1.6%), but this is compensated by memory savings of about 9% which allow for a larger dbcache setting.
Definition at line 107 of file coins.h.
1.8.8