aboutsummaryrefslogtreecommitdiff
path: root/src/bloom.h
diff options
context:
space:
mode:
authorMichael Ford <fanquake@gmail.com>2014-10-31 08:43:19 +0800
committerWladimir J. van der Laan <laanwj@gmail.com>2014-11-21 14:44:21 +0100
commitfa94b9d5623cfd16aa594c28432f25a17b0efb0e (patch)
tree7c94530e14c0c3230883601157ab1cd81257806f /src/bloom.h
parentf2ada138c28bf6b4f4a668c4ab60b55d124c9823 (diff)
downloadbitcoin-fa94b9d5623cfd16aa594c28432f25a17b0efb0e.tar.xz
Convert remaining comments in /src to doxygen format
- Update comments in checkpoints to be doxygen compatible - Update comments in checkqueue to be doxygen compatible - Update coins to be doxygen compatible - Fix comment typo in crypter.h - Update licenses/copyright dates Closes #5325 #5184 #5183 #5182
Diffstat (limited to 'src/bloom.h')
-rw-r--r--src/bloom.h36
1 files changed, 20 insertions, 16 deletions
diff --git a/src/bloom.h b/src/bloom.h
index 143e3b4c79..f54922edb9 100644
--- a/src/bloom.h
+++ b/src/bloom.h
@@ -1,5 +1,5 @@
-// Copyright (c) 2012 The Bitcoin developers
-// Distributed under the MIT/X11 software license, see the accompanying
+// Copyright (c) 2012-2014 The Bitcoin developers
+// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_BLOOM_H
@@ -13,12 +13,14 @@ class COutPoint;
class CTransaction;
class uint256;
-// 20,000 items with fp rate < 0.1% or 10,000 items and <0.0001%
+//! 20,000 items with fp rate < 0.1% or 10,000 items and <0.0001%
static const unsigned int MAX_BLOOM_FILTER_SIZE = 36000; // bytes
static const unsigned int MAX_HASH_FUNCS = 50;
-// First two bits of nFlags control how much IsRelevantAndUpdate actually updates
-// The remaining bits are reserved
+/**
+ * First two bits of nFlags control how much IsRelevantAndUpdate actually updates
+ * The remaining bits are reserved
+ */
enum bloomflags
{
BLOOM_UPDATE_NONE = 0,
@@ -52,13 +54,15 @@ private:
unsigned int Hash(unsigned int nHashNum, const std::vector<unsigned char>& vDataToHash) const;
public:
- // Creates a new bloom filter which will provide the given fp rate when filled with the given number of elements
- // Note that if the given parameters will result in a filter outside the bounds of the protocol limits,
- // the filter created will be as close to the given parameters as possible within the protocol limits.
- // This will apply if nFPRate is very low or nElements is unreasonably high.
- // nTweak is a constant which is added to the seed value passed to the hash function
- // It should generally always be a random value (and is largely only exposed for unit testing)
- // nFlags should be one of the BLOOM_UPDATE_* enums (not _MASK)
+ /**
+ * Creates a new bloom filter which will provide the given fp rate when filled with the given number of elements
+ * Note that if the given parameters will result in a filter outside the bounds of the protocol limits,
+ * the filter created will be as close to the given parameters as possible within the protocol limits.
+ * This will apply if nFPRate is very low or nElements is unreasonably high.
+ * nTweak is a constant which is added to the seed value passed to the hash function
+ * It should generally always be a random value (and is largely only exposed for unit testing)
+ * nFlags should be one of the BLOOM_UPDATE_* enums (not _MASK)
+ */
CBloomFilter(unsigned int nElements, double nFPRate, unsigned int nTweak, unsigned char nFlagsIn);
CBloomFilter() : isFull(true), isEmpty(false), nHashFuncs(0), nTweak(0), nFlags(0) {}
@@ -82,14 +86,14 @@ public:
void clear();
- // True if the size is <= MAX_BLOOM_FILTER_SIZE and the number of hash functions is <= MAX_HASH_FUNCS
- // (catch a filter which was just deserialized which was too big)
+ //! True if the size is <= MAX_BLOOM_FILTER_SIZE and the number of hash functions is <= MAX_HASH_FUNCS
+ //! (catch a filter which was just deserialized which was too big)
bool IsWithinSizeConstraints() const;
- // Also adds any outputs which match the filter to the filter (to match their spending txes)
+ //! Also adds any outputs which match the filter to the filter (to match their spending txes)
bool IsRelevantAndUpdate(const CTransaction& tx);
- // Checks for empty and full filters to avoid wasting cpu
+ //! Checks for empty and full filters to avoid wasting cpu
void UpdateEmptyFull();
};