corda / net.corda.core.transactions / FilteredTransaction

FilteredTransaction

class FilteredTransaction : TraversableTransaction

Class representing merkleized filtered transaction.

Parameters

id - Merkle tree root hash.

filteredComponentGroups - list of transaction components groups remained after filters are applied to WireTransaction.

groupHashes - the roots of the transaction component groups.

Properties

filteredComponentGroups

list of transaction components groups remained after filters are applied to WireTransaction.

val filteredComponentGroups: List<FilteredComponentGroup>

groupHashes

the roots of the transaction component groups.

val groupHashes: List<SecureHash>

id

Merkle tree root hash.

val id: SecureHash

Functions

checkAllComponentsVisible

Function that checks if all of the components in a particular group are visible. This functionality is required on non-Validating Notaries to check that all inputs are visible. It might also be applied in Oracles or any other entity requiring Command visibility, but because this method cannot distinguish between related and unrelated to the signer Commands, one should use the checkCommandVisibility method, which is specifically designed for Command visibility purposes. The logic behind this algorithm is that we check that the root of the provided group partialMerkleTree matches with the root of a fullMerkleTree if computed using all visible components. Note that this method is usually called after or before verify, to also ensure that the provided partial Merkle tree corresponds to the correct leaf in the top Merkle tree.

fun checkAllComponentsVisible(componentGroupEnum: ComponentGroupEnum): Unit

checkCommandVisibility

Function that checks if all of the commands that should be signed by the input public key are visible. This functionality is required from Oracles to check that all of the commands they should sign are visible. This algorithm uses the ComponentGroupEnum.SIGNERS_GROUP to count how many commands should be signed by the input PublicKey and it then matches it with the size of received commands. Note that this method does not throw if there are no commands for this key to sign in the original WireTransaction.

fun checkCommandVisibility(publicKey: PublicKey): Unit

checkWithFun

Function that checks the whole filtered structure. Force type checking on a structure that we obtained, so we don't sign more than expected. Example: Oracle is implemented to check only for commands, if it gets an attachment and doesn't expect it - it can sign over a transaction with the attachment that wasn't verified. Of course it depends on how you implement it, but else -> false should solve a problem with possible later extensions to WireTransaction.

fun checkWithFun(checkingFun: (Any) -> Boolean): Boolean

verify

Runs verification of partial Merkle branch against id. Note that empty filtered transactions (with no component groups) are accepted as well, e.g. for Timestamp Authorities to blindly sign or any other similar case in the future that requires a blind signature over a transaction's id.

fun verify(): Unit

Companion Object Functions

buildFilteredTransaction

Construction of filtered transaction with partial Merkle tree.

fun buildFilteredTransaction(wtx: WireTransaction, filtering: Predicate<Any>): FilteredTransaction