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(OutputStream stream)
Serializes this message to the provided stream.
|
boolean |
equals(Object o) |
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
|
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.
|
String |
toString() |
adjustLength, bitcoinSerialize, bitcoinSerialize, getMessageSize, getParams, hasMoreBytes, isCached, isRecached, readByteArray, readBytes, readHash, readInt64, readStr, readUint32, readUint64, readVarInt, readVarInt, unCache, unsafeBitcoinSerialize
public FilteredBlock(NetworkParameters params, byte[] payloadBytes) throws ProtocolException
ProtocolException
public FilteredBlock(NetworkParameters params, Block header, PartialMerkleTree pmt)
public void bitcoinSerializeToStream(OutputStream stream) throws IOException
Message
bitcoinSerializeToStream
in class Message
IOException
protected void parse() throws ProtocolException
parse
in class Message
ProtocolException
public List<Sha256Hash> getTransactionHashes() throws VerificationException
ProtocolException
- If the partial merkle block is invalid or the merkle root of the partial merkle block doesnt match the block headerVerificationException
public Block getBlockHeader()
public Sha256Hash getHash()
public boolean provideTransaction(Transaction tx) throws VerificationException
VerificationException
public PartialMerkleTree getPartialMerkleTree()
PartialMerkleTree
object that provides the mathematical proof of transaction inclusion in the block.public Map<Sha256Hash,Transaction> getAssociatedTransactions()
public int getTransactionCount()
Copyright © 2018. All rights reserved.