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.
Message.LazyParseException
Modifier and Type | Field and Description |
---|---|
static int |
MIN_PROTOCOL_VERSION
The protocol version at which Bloom filtering started to be supported.
|
checksum, cursor, length, MAX_SIZE, offset, params, parsed, parseLazy, parseRetain, payload, protocolVersion, recached, 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 |
parseLite()
Perform the most minimal parse possible to calculate the length of the message payload.
|
boolean |
provideTransaction(Transaction tx)
Provide this FilteredBlock with a transaction which is in its Merkle tree.
|
String |
toString() |
adjustLength, bitcoinSerialize, bitcoinSerialize, ensureParsed, getMessageSize, getParams, isCached, isParsed, isRecached, maybeParse, unCache, unsafeBitcoinSerialize
public static final int MIN_PROTOCOL_VERSION
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
IOException
protected void parseLite() throws ProtocolException
Message
parseLite
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 © 2015. All rights reserved.