Package org.bitcoinj.core
Class FilteredBlock
java.lang.Object
org.bitcoinj.core.Message
org.bitcoinj.core.FilteredBlock
A FilteredBlock is used to relay a block with its transactions filtered using a BloomFilter
. It consists
of the block header and a PartialMerkleTree
which contains the transactions which matched the filter.
Instances of this class are not safe for use by multiple threads.
-
Field Summary
Fields inherited from class org.bitcoinj.core.Message
cursor, length, MAX_SIZE, offset, params, payload, recached, serializer, UNKNOWN_LENGTH
-
Constructor Summary
ConstructorDescriptionFilteredBlock
(NetworkParameters params, byte[] payloadBytes) FilteredBlock
(NetworkParameters params, Block header, PartialMerkleTree pmt) -
Method Summary
Modifier and TypeMethodDescriptionvoid
bitcoinSerializeToStream
(OutputStream stream) Serializes this message to the provided stream.boolean
Gets the set of transactions which were provided using provideTransaction() which match in getTransactionHashes()Gets a copy of the block headergetHash()
Gets the hash of the block represented in this Filtered BlockReturns thePartialMerkleTree
object that provides the mathematical proof of transaction inclusion in the block.int
Number of transactions in this block, before it was filteredGets a list of leaf hashes which are contained in the partial merkle tree in this filtered blockint
hashCode()
protected void
parse()
boolean
Provide this FilteredBlock with a transaction which is in its Merkle tree.toString()
Methods inherited from class org.bitcoinj.core.Message
adjustLength, bitcoinSerialize, bitcoinSerialize, getMessageSize, getParams, hasMoreBytes, isCached, isRecached, readByte, readByteArray, readBytes, readHash, readInt64, readStr, readUint32, readUint64, readVarInt, readVarInt, setSerializer, unCache, unsafeBitcoinSerialize
-
Constructor Details
-
FilteredBlock
- Throws:
ProtocolException
-
FilteredBlock
-
-
Method Details
-
bitcoinSerializeToStream
Description copied from class:Message
Serializes this message to the provided stream. If you just want the raw bytes use bitcoinSerialize().- Overrides:
bitcoinSerializeToStream
in classMessage
- Throws:
IOException
-
parse
- Specified by:
parse
in classMessage
- Throws:
ProtocolException
-
getTransactionHashes
Gets a list of leaf hashes which are contained in the partial merkle tree in this filtered block- Throws:
ProtocolException
- If the partial merkle block is invalid or the merkle root of the partial merkle block doesn't match the block headerVerificationException
-
getBlockHeader
Gets a copy of the block header -
getHash
Gets the hash of the block represented in this Filtered Block -
provideTransaction
Provide this FilteredBlock with a transaction which is in its Merkle tree.- Returns:
- false if the tx is not relevant to this FilteredBlock
- Throws:
VerificationException
-
getPartialMerkleTree
Returns thePartialMerkleTree
object that provides the mathematical proof of transaction inclusion in the block. -
getAssociatedTransactions
Gets the set of transactions which were provided using provideTransaction() which match in getTransactionHashes() -
getTransactionCount
public int getTransactionCount()Number of transactions in this block, before it was filtered -
equals
-
hashCode
public int hashCode() -
toString
-