Package com.norswap.nanoeth.receipts
Class BloomFilter
java.lang.Object
com.norswap.nanoeth.receipts.BloomFilter
- All Implemented Interfaces:
RLPLayoutable
@Wrapper public final class BloomFilter extends Object implements RLPLayoutable
A bloom filter associated with one or multiple
LogEntry
.
In practice, such a bloom filter is constructed from all the log entries in a block,
and included in the block header as BlockHeader.logsBloom
.
See LogTopic
for an explanation of the usefulness of bloom filters.
-
Field Summary
Fields Modifier and Type Field Description byte[]
bits
The bytes making up the hash. -
Constructor Summary
Constructors Constructor Description BloomFilter()
Creates a new empty bloom filter.BloomFilter(byte[] bits)
BloomFilter(String hexString)
Creates a bloom filter from a hex string (e.g. -
Method Summary
Modifier and Type Method Description boolean
equals(Object o)
int
hashCode()
boolean
mayContain(Address address)
Indicates if the log entries associated to this bloom filter may have been been logged by the given address.boolean
mayContain(LogTopic topic)
Indicates if some of the log entries associated to this bloom filter may contain the given topic.static BloomFilter
parse(RLP rlp)
RLP
rlpLayout()
Returns the RLP layout for the object.String
toHexString()
The hex-string representation of this hash, including leading 0 if any, as perByteUtils.toFullHexString(byte[])
.String
toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.norswap.nanoeth.rlp.RLPLayoutable
rlpEncode, rlpHexString
-
Field Details
-
bits
public final byte[] bitsThe bytes making up the hash.
-
-
Constructor Details
-
BloomFilter
public BloomFilter()Creates a new empty bloom filter. -
BloomFilter
-
BloomFilter
Creates a bloom filter from a hex string (e.g. 0x123).If the post-0x part of the hex string is not 512 characters long, the hash will be padded with zeroes at the start so that it is 256 bytes long.
-
-
Method Details
-
parse
- Throws:
RLPParsingException
-
mayContain
Indicates if some of the log entries associated to this bloom filter may contain the given topic.This can return true if the no log entries contains the topic, but may not return false if the some log entry contains the topic.
-
mayContain
Indicates if the log entries associated to this bloom filter may have been been logged by the given address.This can return true if no log entry was logged by the address, but may not return false if some log entry was logged by the address.
-
toHexString
The hex-string representation of this hash, including leading 0 if any, as perByteUtils.toFullHexString(byte[])
. -
rlpLayout
Description copied from interface:RLPLayoutable
Returns the RLP layout for the object.- Specified by:
rlpLayout
in interfaceRLPLayoutable
-
equals
-
hashCode
public int hashCode() -
toString
-