aboutsummaryrefslogtreecommitdiff
path: root/src/netaddress.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/netaddress.h')
-rw-r--r--src/netaddress.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/netaddress.h b/src/netaddress.h
index b06b6c65b6..debe03988c 100644
--- a/src/netaddress.h
+++ b/src/netaddress.h
@@ -562,6 +562,14 @@ public:
class CServiceHash
{
public:
+ CServiceHash()
+ : m_salt_k0{GetRand(std::numeric_limits<uint64_t>::max())},
+ m_salt_k1{GetRand(std::numeric_limits<uint64_t>::max())}
+ {
+ }
+
+ CServiceHash(uint64_t salt_k0, uint64_t salt_k1) : m_salt_k0{salt_k0}, m_salt_k1{salt_k1} {}
+
size_t operator()(const CService& a) const noexcept
{
CSipHasher hasher(m_salt_k0, m_salt_k1);
@@ -572,8 +580,8 @@ public:
}
private:
- const uint64_t m_salt_k0 = GetRand(std::numeric_limits<uint64_t>::max());
- const uint64_t m_salt_k1 = GetRand(std::numeric_limits<uint64_t>::max());
+ const uint64_t m_salt_k0;
+ const uint64_t m_salt_k1;
};
#endif // BITCOIN_NETADDRESS_H