14 #define LN2SQUARED 0.4804530139182014246671025263266649717305529515945455
15 #define LN2 0.6931471805599453094172321214581765680755001343602552
23 vData(min((unsigned int)(-1 /
LN2SQUARED * nElements * log(nFPRate)), MAX_BLOOM_FILTER_SIZE * 8) / 8),
29 nHashFuncs(min((unsigned int)(vData.size() * 8 / nElements *
LN2), MAX_HASH_FUNCS)),
35 inline unsigned int CBloomFilter::Hash(
unsigned int nHashNum,
const std::vector<unsigned char>& vDataToHash)
const
47 unsigned int nIndex =
Hash(i, vKey);
49 vData[nIndex >> 3] |= (1 << (7 & nIndex));
58 vector<unsigned char> data(stream.begin(), stream.end());
64 vector<unsigned char> data(hash.
begin(), hash.
end());
76 unsigned int nIndex =
Hash(i, vKey);
78 if (!(
vData[nIndex >> 3] & (1 << (7 & nIndex))))
88 vector<unsigned char> data(stream.
begin(), stream.
end());
94 vector<unsigned char> data(hash.
begin(), hash.
end());
100 return vData.size() <= MAX_BLOOM_FILTER_SIZE &&
nHashFuncs <= MAX_HASH_FUNCS;
115 for (
unsigned int i = 0; i < tx.
vout.size(); i++)
122 CScript::const_iterator pc = txout.
scriptPubKey.begin();
123 vector<unsigned char> data;
129 if (data.size() != 0 &&
contains(data))
137 vector<vector<unsigned char> > vSolutions;
150 BOOST_FOREACH(
const CTxIn& txin, tx.
vin)
157 CScript::const_iterator pc = txin.
scriptSig.begin();
158 vector<unsigned char> data;
164 if (data.size() != 0 &&
contains(data))
176 for (
unsigned int i = 0; i <
vData.size(); i++)
178 full &=
vData[i] == 0xff;
179 empty &=
vData[i] == 0;
const_iterator begin() const
unsigned int Hash(unsigned int nHashNum, const std::vector< unsigned char > &vDataToHash) const
std::vector< unsigned char > vData
Double ended buffer combining vector and stream-like interfaces.
void insert(const uint256 &hash)
bool IsWithinSizeConstraints() const
unsigned int MurmurHash3(unsigned int nHashSeed, const std::vector< unsigned char > &vDataToHash)
opcodetype
Script opcodes.
An input of a transaction.
std::vector< CTxOut > vout
bool contains(const std::vector< unsigned char > &vKey) const
bool Solver(const CScript &scriptPubKey, txnouttype &typeRet, vector< vector< unsigned char > > &vSolutionsRet)
An output of a transaction.
An outpoint - a combination of a transaction hash and an index n into its vout.
bool IsRelevantAndUpdate(const CTransaction &tx, const uint256 &hash)
bool GetOp(iterator &pc, opcodetype &opcodeRet, std::vector< unsigned char > &vchRet)
The basic transaction that is broadcasted on the network and contained in blocks. ...
const_iterator end() const