20#define LN2SQUARED 0.4804530139182014246671025263266649717305529515945455
21#define LN2 0.6931471805599453094172321214581765680755001343602552
62 vData[nIndex >> 3] |= (1 << (7 & nIndex));
80 if (!(
vData[nIndex >> 3] & (1 << (7 & nIndex)))) {
112 for (
size_t i = 0; i < tx.
vout.size(); i++) {
121 std::vector<uint8_t> data;
127 if (data.size() != 0 &&
contains(data)) {
158 std::vector<uint8_t> data;
159 while (pc <
txin.scriptSig.end()) {
161 if (!
txin.scriptSig.GetOp(pc, opcode, data)) {
164 if (data.size() != 0 &&
contains(data)) {
256 if (!(((
data[pos & ~1] |
data[pos | 1]) >>
bit) & 1)) {
267 std::fill(
data.begin(),
data.end(), 0);
static uint32_t RollingBloomHash(uint32_t nHashNum, uint32_t nTweak, Span< const uint8_t > vDataToHash)
static const uint32_t MAX_BLOOM_FILTER_SIZE
20,000 items with fp rate < 0.1% or 10,000 items and <0.0001%
static const uint32_t 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...
bool contains(Span< const uint8_t > vKey) const
void insert(Span< const uint8_t > vKey)
std::vector< uint8_t > vData
bool MatchInputs(const CTransaction &tx)
Scan inputs to see if the spent outpoints are a match, or the input scripts contain matching elements...
bool MatchAndInsertOutputs(const CTransaction &tx)
Scans output scripts for matches and adds those outpoints to the filter for spend detection.
uint32_t Hash(uint32_t nHashNum, Span< const uint8_t > vDataToHash) const
Double ended buffer combining vector and stream-like interfaces.
An outpoint - a combination of a transaction hash and an index n into its vout.
CRollingBloomFilter(const uint32_t nElements, const double nFPRate)
int nEntriesPerGeneration
int nEntriesThisGeneration
std::vector< uint64_t > data
void insert(Span< const uint8_t > vKey)
bool contains(Span< const uint8_t > vKey) const
bool GetOp(const_iterator &pc, opcodetype &opcodeRet, std::vector< uint8_t > &vchRet) const
The basic transaction that is broadcasted on the network and contained in blocks.
const std::vector< CTxOut > vout
const std::vector< CTxIn > vin
An input of a transaction.
An output of a transaction.
A Span is an object that can refer to a contiguous sequence of objects.
static uint32_t FastRange32(uint32_t x, uint32_t n)
This file offers implementations of the fast range reduction technique described in https://lemire....
uint32_t MurmurHash3(uint32_t nHashSeed, Span< const uint8_t > vDataToHash)
Implement std::hash so RCUPtr can be used as a key for maps or sets.
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
opcodetype
Script opcodes.
constexpr auto MakeUCharSpan(V &&v) -> decltype(UCharSpanCast(Span{std::forward< V >(v)}))
Like the Span constructor, but for (const) uint8_t member types only.
TxoutType Solver(const CScript &scriptPubKey, std::vector< std::vector< uint8_t > > &vSolutionsRet)
Parse a scriptPubKey and identify script type for standard scripts.
A TxId is the identifier of a transaction.
static const int PROTOCOL_VERSION
network protocol versioning