aboutsummaryrefslogtreecommitdiff
path: root/src/bloom.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/bloom.h')
-rw-r--r--src/bloom.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/bloom.h b/src/bloom.h
index a59b1d99f5..389ae748e6 100644
--- a/src/bloom.h
+++ b/src/bloom.h
@@ -16,6 +16,16 @@ class CTransaction;
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
+enum bloomflags
+{
+ BLOOM_UPDATE_NONE = 0,
+ BLOOM_UPDATE_ALL = 1,
+ // Only adds outpoints to the filter if the output is a pay-to-pubkey/pay-to-multisig script
+ BLOOM_UPDATE_P2PUBKEY_ONLY = 2,
+ BLOOM_UPDATE_MASK = 3,
+};
/**
* BloomFilter is a probabilistic filter which SPV clients provide
@@ -34,6 +44,7 @@ private:
std::vector<unsigned char> vData;
unsigned int nHashFuncs;
unsigned int nTweak;
+ unsigned char nFlags;
unsigned int Hash(unsigned int nHashNum, const std::vector<unsigned char>& vDataToHash) const;
@@ -44,7 +55,8 @@ public:
// 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)
- CBloomFilter(unsigned int nElements, double nFPRate, unsigned int nTweak);
+ // nFlags should be one of the BLOOM_UPDATE_* enums (not _MASK)
+ CBloomFilter(unsigned int nElements, double nFPRate, unsigned int nTweak, unsigned char nFlagsIn);
// Using a filter initialized with this results in undefined behavior
// Should only be used for deserialization
CBloomFilter() {}
@@ -54,6 +66,7 @@ public:
READWRITE(vData);
READWRITE(nHashFuncs);
READWRITE(nTweak);
+ READWRITE(nFlags);
)
void insert(const std::vector<unsigned char>& vKey);