public class FilteredBlock extends Message
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.
cursor, length, MAX_SIZE, offset, params, payload, protocolVersion, recached, serializer, UNKNOWN_LENGTH| Constructor and Description |
|---|
FilteredBlock(NetworkParameters params,
Block header,
PartialMerkleTree pmt) |
FilteredBlock(NetworkParameters params,
byte[] payloadBytes) |
| Modifier and Type | Method and Description |
|---|---|
void |
bitcoinSerializeToStream(java.io.OutputStream stream)
Serializes this message to the provided stream.
|
boolean |
equals(java.lang.Object o) |
java.util.Map<Sha256Hash,Transaction> |
getAssociatedTransactions()
Gets the set of transactions which were provided using provideTransaction() which match in getTransactionHashes()
|
Block |
getBlockHeader()
Gets a copy of the block header
|
Sha256Hash |
getHash()
Gets the hash of the block represented in this Filtered Block
|
PartialMerkleTree |
getPartialMerkleTree()
Returns the
PartialMerkleTree object that provides the mathematical proof of transaction inclusion in the block. |
int |
getTransactionCount()
Number of transactions in this block, before it was filtered
|
java.util.List<Sha256Hash> |
getTransactionHashes()
Gets a list of leaf hashes which are contained in the partial merkle tree in this filtered block
|
int |
hashCode() |
protected void |
parse() |
boolean |
provideTransaction(Transaction tx)
Provide this FilteredBlock with a transaction which is in its Merkle tree.
|
java.lang.String |
toString() |
adjustLength, bitcoinSerialize, bitcoinSerialize, getMessageSize, getParams, hasMoreBytes, isCached, isRecached, readByteArray, readBytes, readHash, readInt64, readStr, readUint32, readUint64, readVarInt, readVarInt, unCache, unsafeBitcoinSerializepublic FilteredBlock(NetworkParameters params, byte[] payloadBytes) throws ProtocolException
ProtocolExceptionpublic FilteredBlock(NetworkParameters params, Block header, PartialMerkleTree pmt)
public void bitcoinSerializeToStream(java.io.OutputStream stream)
throws java.io.IOException
MessagebitcoinSerializeToStream in class Messagejava.io.IOExceptionprotected void parse()
throws ProtocolException
parse in class MessageProtocolExceptionpublic java.util.List<Sha256Hash> getTransactionHashes() throws VerificationException
ProtocolException - If the partial merkle block is invalid or the merkle root of the partial merkle block doesn't match the block headerVerificationExceptionpublic Block getBlockHeader()
public Sha256Hash getHash()
public boolean provideTransaction(Transaction tx) throws VerificationException
VerificationExceptionpublic PartialMerkleTree getPartialMerkleTree()
PartialMerkleTree object that provides the mathematical proof of transaction inclusion in the block.public java.util.Map<Sha256Hash,Transaction> getAssociatedTransactions()
public int getTransactionCount()
public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object