22static constexpr double LN2SQUARED = 0.4804530139182014246671025263266649717305529515945455;
23static constexpr double LN2 = 0.6931471805599453094172321214581765680755001343602552;
57 vData[nIndex >> 3] |= (1 << (7 & nIndex));
76 if (!(
vData[nIndex >> 3] & (1 << (7 & nIndex))))
105 for (
unsigned int i = 0; i < tx.
vout.size(); i++)
113 std::vector<unsigned char> data;
119 if (data.size() != 0 &&
contains(data))
126 std::vector<std::vector<unsigned char> >
vSolutions;
148 std::vector<unsigned char> data;
149 while (
pc <
txin.scriptSig.end())
154 if (data.size() != 0 &&
contains(data))
233 if (!(((
data[pos & ~1U] |
data[pos | 1]) >> bit) & 1)) {
245 std::fill(
data.begin(),
data.end(), 0);
static constexpr double LN2SQUARED
static constexpr double LN2
static uint32_t RollingBloomHash(unsigned int nHashNum, uint32_t nTweak, std::span< const unsigned char > vDataToHash)
static constexpr unsigned int MAX_BLOOM_FILTER_SIZE
20,000 items with fp rate < 0.1% or 10,000 items and <0.0001%
static constexpr unsigned int MAX_HASH_FUNCS
@ BLOOM_UPDATE_P2PUBKEY_ONLY
bool IsWithinSizeConstraints() const
True if the size is <= MAX_BLOOM_FILTER_SIZE and the number of hash functions is <= MAX_HASH_FUNCS (c...
std::vector< unsigned char > vData
void insert(std::span< const unsigned char > vKey)
unsigned int Hash(unsigned int nHashNum, std::span< const unsigned char > vDataToHash) const
bool contains(std::span< const unsigned char > vKey) const
bool IsRelevantAndUpdate(const CTransaction &tx)
Also adds any outputs which match the filter to the filter (to match their spending txes)
An outpoint - a combination of a transaction hash and an index n into its vout.
CRollingBloomFilter(unsigned int nElements, double nFPRate)
bool contains(std::span< const unsigned char > vKey) const
int nEntriesPerGeneration
int nEntriesThisGeneration
std::vector< uint64_t > data
void insert(std::span< const unsigned char > vKey)
bool GetOp(const_iterator &pc, opcodetype &opcodeRet, std::vector< unsigned char > &vchRet) const
The basic transaction that is broadcasted on the network and contained in blocks.
const std::vector< CTxOut > vout
const Txid & GetHash() const LIFETIMEBOUND
const std::vector< CTxIn > vin
An input of a transaction.
An output of a transaction.
Double ended buffer combining vector and stream-like interfaces.
I rand() noexcept
Generate a random integer in its entire (non-negative) range.
const uint256 & ToUint256() const LIFETIMEBOUND
static uint32_t FastRange32(uint32_t x, uint32_t n)
Fast range reduction with 32-bit input and 32-bit range.
unsigned int MurmurHash3(unsigned int nHashSeed, std::span< const unsigned char > vDataToHash)
opcodetype
Script opcodes.
TxoutType Solver(const CScript &scriptPubKey, std::vector< std::vector< unsigned char > > &vSolutionsRet)
Parse a scriptPubKey and identify script type for standard scripts.
constexpr auto MakeUCharSpan(const V &v) -> decltype(UCharSpanCast(std::span{v}))
Like the std::span constructor, but for (const) unsigned char member types only.
constexpr auto Ticks(Dur2 d)
Helper to count the seconds of a duration/time_point.